deech 2017-02-07 15:52:57
Hi all, is it possible to load a shared library built with g++ into GHCi? It has a bunch of extern'ed symbols which I'm trying to use.
geekosaur 2017-02-07 15:55:25
you might need to tell it to include -lstdc++ (or -lc++ for clang / OS X or *BSD)
yushyin 2017-02-07 15:56:03
deech: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#extra-libraries
geekosaur 2017-02-07 15:56:04
otherwise your biggest problem is likely to be mangled symbols if you are trying to FFI, and of course anything needing a C++-specific type won't work via FFI
deech 2017-02-07 15:56:50
geekosaur: But all I'm only trying to access extern'd symbols in theory I should be good?
qmm 2017-02-07 15:57:00
i'm dealing with an m a and i really need that a
geekosaur 2017-02-07 15:57:12
are they extern "C"?
geekosaur 2017-02-07 15:57:24
qmm, "that a" may not exist
deech 2017-02-07 15:57:39
geekosaur: Yeah.
yushyin 2017-02-07 15:58:38
:t (>>=)
lambdabot 2017-02-07 15:58:40
Monad m => m a -> (a -> m b) -> m b
yushyin 2017-02-07 15:59:03
qmm: you provide the m a and the a -> m b and >>= will deal with the 'a' for you
qmm 2017-02-07 15:59:14
geekosaur: i was declaring that an m a was coming across, but actually i was getting an a
pistachio_ 2017-02-07 16:04:20
HELP
pistachio_ 2017-02-07 16:04:54
guys, can I ask a question?
qmm 2017-02-07 16:04:59
pistachio_: go for it
suzu 2017-02-07 16:05:01
yes
suzu 2017-02-07 16:05:03
of course
pistachio_ 2017-02-07 16:06:14
I am new to Haskell and when I type "gchi" into the compiler, it says there is an error. Why does that happen?
qmm 2017-02-07 16:06:36
pistachio_: can you paste the error at lpaste.net?
qmm 2017-02-07 16:07:13
http://lpaste.net/new/haskell rather
Koterpillar 2017-02-07 16:07:31
pistachio_: it should be 'ghci', not 'gchi'
geekosaur 2017-02-07 16:07:47
and, "into the compiler"?
Koterpillar 2017-02-07 16:08:00
> ghci
geekosaur 2017-02-07 16:08:00
would be at the shell or CMD/PowerShell prompt
pistachio_ 2017-02-07 16:08:01
haha, I know, that was a typo in the chat
lambdabot 2017-02-07 16:08:03
error: Variable not in scope: ghci
pistachio_ 2017-02-07 16:08:11
exactly
pistachio_ 2017-02-07 16:09:01
:1:1: error: Variable not in scope: ghci
pistachio_ 2017-02-07 16:09:11
that is what it spells
pistachio_ 2017-02-07 16:09:17
:(
geekosaur 2017-02-07 16:09:25
why are you trying to run ghci from ghci?
Koterpillar 2017-02-07 16:09:28
pistachio_: you are already in ghci, likely. What did you want to do?
Welkin 2017-02-07 16:09:38
is that like running emacs inside emacs?
suzu 2017-02-07 16:09:40
you made it fam
Welkin 2017-02-07 16:09:43
because it can be done
suzu 2017-02-07 16:09:45
we up in ghci now
Welkin 2017-02-07 16:09:46
and I have done it :D
nitrix 2017-02-07 16:10:12
pistachio_: It might be that you're confusing GHCi for a terminal emulator.
pistachio_ 2017-02-07 16:10:28
could be
nitrix 2017-02-07 16:10:47
pistachio_: The error message you gave seems like it'd be coming from GHCi so it hints that you'd be trying to run the function `ghci` with GHCi, which wont work.
pistachio_ 2017-02-07 16:10:59
alright
pistachio_ 2017-02-07 16:11:04
thank you
pistachio_ 2017-02-07 16:11:11
however
pistachio_ 2017-02-07 16:11:17
when I try to run a file
nitrix 2017-02-07 16:11:26
pistachio_: What happens if you do :help ?
pistachio_ 2017-02-07 16:11:36
it gives me an error again
pistachio_ 2017-02-07 16:11:45
when I try to load the file
geekosaur 2017-02-07 16:12:07
in ghci, it'd be: :load MyFile.hs
nitrix 2017-02-07 16:12:10
pistachio_: http://lpaste.net could you paste the file and your error there?
pistachio_ 2017-02-07 16:12:14
precisely
pistachio_ 2017-02-07 16:12:22
that is how I did it
pistachio_ 2017-02-07 16:13:05
just a moment,please
pistachio_ 2017-02-07 16:14:15
MyFile is not a module name or a source file
Jello_Raptor 2017-02-07 16:14:40
huh, where do I find the functions for working with AssocLists ?
nitrix 2017-02-07 16:14:41
Is your file named MyFile.hs ?
nitrix 2017-02-07 16:15:00
Is it also located where you launched GHCi from?
pistachio_ 2017-02-07 16:15:12
yes, it has the .hs at the end
nitrix 2017-02-07 16:15:20
You might have to use :cd to change directory, or change the working directory prior to launching GHCi.
nitrix 2017-02-07 16:16:15
pistachio_: Would you happen to be a Windows user?
pistachio_ 2017-02-07 16:16:17
the folder with the file is in the same place as where I launch haskell from
pistachio_ 2017-02-07 16:16:40
yep
pistachio_ 2017-02-07 16:16:43
windows
nitrix 2017-02-07 16:17:05
I believe the windows installer for Haskell Platform adds a link in the right click contextual menu to load a file automatically in GHCi.
nitrix 2017-02-07 16:17:25
"Run in GHCi" or something.
nitrix 2017-02-07 16:17:45
That could be a good starting point.
pistachio_ 2017-02-07 16:19:23
I have a separate icon called winghci
pistachio_ 2017-02-07 16:19:36
is that it?
deech 2017-02-07 16:19:55
geekosaur: I think I figured it out. The option to pass to GHCi is `-fobject-code`. Not exactly sure what it does.
nitrix 2017-02-07 16:20:20
pistachio_: If you're seeing winghci, you're most likely not in the good menu.
nitrix 2017-02-07 16:20:52
pistachio_: The one I was talking about is by rick-clicking on the file, and chosing the 2nd or 3rd option down the list, if I remember, it should say "Run in GHCi"
Koterpillar 2017-02-07 16:21:38
http://stackoverflow.blog/2017/02/What-Programming-Languages-Weekends/ Haskell is on top
nitrix 2017-02-07 16:22:28
A second alternative is to launch GHCi and use :cd to change directory to where your project is located or launch cmd.exe, use cd to change directory, then execute ghci. Both approaches are equally as good.
pistachio_ 2017-02-07 16:22:52
oh, I got it
pistachio_ 2017-02-07 16:22:55
sorry
pistachio_ 2017-02-07 16:23:11
opened it with right click
nitrix 2017-02-07 16:23:55
That's a good starting point. It's probably enough to write simple projects for now and test them :)
pistachio_ 2017-02-07 16:24:22
yes!
pistachio_ 2017-02-07 16:24:27
thank you so much!
pistachio_ 2017-02-07 16:24:44
that is all I needed at the moment!
nitrix 2017-02-07 16:25:00
Ideally you'd get more comfortable with running commands on Windows if you're going to use GHCi (which is a command line application and text-based).
pistachio_ 2017-02-07 16:25:14
alright
nitrix 2017-02-07 16:25:20
:]
pistachio_ 2017-02-07 16:25:27
<3
pistachio_ 2017-02-07 16:25:43
have good night guys!
pistachio_ 2017-02-07 16:25:49
or good day!
deech 2017-02-07 16:35:28
Anyone know if there is way of specifying `ghc-options` in your .cabal file that are *not* used when running in GHCi? Is there something like an `if (repl)` conditional available?