
Hi, I am trying to run this basic multiline code in GHCi. I am not sure if this is even possible without writing it in a file and compiling it in a traditional way. ------- Prelude> :set +m Prelude> let main1 = do Prelude| a <- readLn Prelude| return a Prelude| Prelude> Prelude> main1 <interactive>:75:1: No instance for (Show (IO b0)) arising from a use of `print' In the first argument of `print', namely `it' In a stmt of an interactive GHCi command: print it ------- Could someone please confirm if the function can be defined and called like this in GHCi or point to where am going wrong. Thanks, Shishir Srivastava

Hi Shishir, If you wrap multiline code in between Prelude> :{ Prelude| let main1 = do Prelude| a <- getLine Prelude| return a Prelude| :} Prelude> main1 hello "hello" It will work. On Fri, Aug 7, 2015 at 8:45 PM, Shishir Srivastava < shishir.srivastava@gmail.com> wrote:
Hi,
I am trying to run this basic multiline code in GHCi. I am not sure if this is even possible without writing it in a file and compiling it in a traditional way.
------- Prelude> :set +m Prelude> let main1 = do Prelude| a <- readLn Prelude| return a Prelude| Prelude> Prelude> main1
<interactive>:75:1: No instance for (Show (IO b0)) arising from a use of `print' In the first argument of `print', namely `it' In a stmt of an interactive GHCi command: print it -------
Could someone please confirm if the function can be defined and called like this in GHCi or point to where am going wrong.
Thanks, Shishir Srivastava
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

On Fri, Aug 7, 2015 at 11:15 AM, Shishir Srivastava < shishir.srivastava@gmail.com> wrote:
Prelude> :set +m Prelude> let main1 = do Prelude| a <- readLn Prelude| return a Prelude| Prelude> Prelude> main1
<interactive>:75:1: No instance for (Show (IO b0)) arising from a use of `print'
In an actual program, it would be able to apply defaulting rules and monomorphize `b0` to Integer. The somewhat unusual ghci environment, in particular how it tries to figure out whether to evaluate an expression and `print` the result or instead run an IO action --- coupled with the monomorphism restriction being disabled in the interactive context in ghci 7.8 and later --- is working against you here. As a result, you need to specify a result type when invoking `main1`, which is what the error message is telling you. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

Just revisiting haskell after a hiatus and to begin that with a rather uncalled for query - In the system type declaration for the data type Bool as below what are the types of the two values 'True' and 'False' *data Bool = False | True* Are the values 'String' ? In which case how's the Bool data type different from String enumerator data type ? Thanks, S

The type of both True and False is Bool. Just like the type of 1 and
2 and 3 is Integer.
Bool and Integer are types. True, False, and 42 are all values.
On Tue, Aug 29, 2017 at 11:04 AM, Shishir Srivastava
Just revisiting haskell after a hiatus and to begin that with a rather uncalled for query -
In the system type declaration for the data type Bool as below what are the types of the two values 'True' and 'False'
data Bool = False | True
Are the values 'String' ? In which case how's the Bool data type different from String enumerator data type ?
Thanks, S
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

Sorry, I should have kept reading. stack setup will most likely
install ghc without a problem.
Since stack doesn't appear to support your distro, if it doesn't it
may be because you are missing some of those libraries it mentions.
It looks like it is based on debian, so you would go apt-get install
<pkg> the various packages gcc, make, libffi, zlib, libgmp and
libtinfo.
If stack setup succeeds, then you stack install and after that, you
should have files in /home/third/.local/bin, one of which is likely
idris.
Hopefully everything works okay for you!
On Tue, Aug 29, 2017 at 11:49 AM, Manny Romero
Thanks! I don't have the slightest idea what any of this did, with the exception of "cd Idris-dev", but it seems to have worked...up until I got this message:
Populated index cache. No compiler found, expected minor version match with ghc-8.0.2 (x86_64) (based on resolver setting in /home/third/Idris-dev/stack.yaml). To install the correct GHC into /home/third/.stack/programs/x86_64-linux/, try running "stack setup" or use the "--install-ghc" flag.
...additionally, I don't seem to have acquired a ~/.local/bin/idris ("no such file or directory"), nor for that matter do I know how to adjust my PATH.
Also, for what it may be worth, I had been warned after the "curl -sSL https://get.haskellstack.org/ | sh" that:
Detected Linux distribution: linuxmint This installer doesn't support your Linux distribution, trying generic bindist... Stack has been installed to: /usr/local/bin/stack Since this installer doesn't support your Linux distribution, there is no guarantee that 'stack' will work at all! You may need to manually install some system info dependencies for GHC: gcc, make, libffi, zlib, libgmp and libtinfo Please see http://docs.haskellstack.org/en/stable/install_and_upgrade/ Pull requests to add support for this distro would be welcome! WARNING: '/home/third/.local/bin' is not on your PATH. For best results, please add it to the beginning of PATH in your profile.
...Sorry to be so completely clueless about the most basic aspects of what's going on, but it really is the state of my knowledge for now!
-------------------------
Date: Tue, 29 Aug 2017 09:08:35 -0400 From: David McBride
To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell Subject: Re: [Haskell-beginners] Installing Idris for Linux Dummies: "The following packages are likely to be broken..." Message-ID: Content-Type: text/plain; charset="UTF-8" The problem most users face with using straight up cabal is that often the needs of one package conflict with the needs of some of the others you've installed. I highly recommend you use stack to install idris. The process should look something like this:
download stack, install it. (directions here: https://docs.haskellstack.org/en/stable/README/) git clone https://github.com/idris-lang/Idris-dev.git cd idris-dev stack install
And then either run ~/.local/bin/idris or make sure .local/bin is in your PATH so that you can run idris on the command line.
On Tue, Aug 29, 2017 at 9:02 AM, Manny Romero
wrote: I am a Linux user (Mint 18) trying to install Idris. I don't know the slightest thing about computers. I barely managed to install Linux, and later the full GHC, based on ample instructions available on the Web. (Still don't actually recall how I did it!)
Idris, however, seems a little trickier. I followed the website (https://www.idris-lang.org/download/)'s instructions:
cabal update cabal install idris
...because apparently I installed "cabal" at some point. But I get this message, which apparently is quite common:
cabal: The following packages are likely to be broken by the reinstalls: semigroupoids-5.1 lens-4.15.1 kan-extensions-5.0.1 profunctors-5.2 comonad-5 bifunctors-5.4.1 Use --force-reinstalls if you want to install anyway.
...those are some of my favorite things! I can't live without them! I am reading things about creating a "sandbox" and so forth. But I cannot use or make sense of this information. I don't know the first thing about cabal; I never use it; I just load everything into GHCI all the time.
Does anyone have some *specific* instructions that I can follow (as "rotely" and dumbly as possible) to get Idris downloaded so I can use it for some beginning studies, without breaking Haskell?
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


You are very close. Try apt-get install zlib or possibly apt-get
install zlib-dev. I'm also seeing a possible zlib-bin. This is all
mint specific info, so I can't get any closer than that.
You will not get a .local directory until you succesfully install a
package via stack for the first time.
On Tue, Aug 29, 2017 at 12:24 PM, Manny Romero
stack setup succeeded! But stack install got to 10/90 before:
Process exited with code: ExitFailure 1 Configuring digest-0.0.1.2... Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2: Missing dependency on a foreign library: * Missing (or bad) header file: zlib.h * Missing C library: z This problem can usually be solved by installing the system package that provides this library (you may need the "-dev" version). If the library is already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where it is. If the header file does exist, it may contain errors that are caught by the C compiler at the preprocessing stage. In this case you can re-run configure with the verbosity flag -v3 to see the error messages.
...Also, I don't seem to have a .local/bin. The only thing I see in .local is a folder "share", which seems to have a bunch of things inside that came with the Linux distribution (the file manager and so forth). I don't know how or if this is related to the problem.
Thanks again. This is really the only place I can think of that could give me any hope of getting this installed. Sent: Tuesday, August 29, 2017 at 12:01 PM From: "David McBride"
To: "Manny Romero" Cc: "Haskell Beginners" Subject: Re: [Haskell-beginners] Multiline code in GHCi Sorry, I should have kept reading. stack setup will most likely install ghc without a problem. Since stack doesn't appear to support your distro, if it doesn't it may be because you are missing some of those libraries it mentions. It looks like it is based on debian, so you would go apt-get install <pkg> the various packages gcc, make, libffi, zlib, libgmp and libtinfo.
If stack setup succeeds, then you stack install and after that, you should have files in /home/third/.local/bin, one of which is likely idris.
Hopefully everything works okay for you!
On Tue, Aug 29, 2017 at 11:49 AM, Manny Romero
wrote: Thanks! I don't have the slightest idea what any of this did, with the exception of "cd Idris-dev", but it seems to have worked...up until I got this message:
Populated index cache. No compiler found, expected minor version match with ghc-8.0.2 (x86_64) (based on resolver setting in /home/third/Idris-dev/stack.yaml). To install the correct GHC into /home/third/.stack/programs/x86_64-linux/, try running "stack setup" or use the "--install-ghc" flag.
...additionally, I don't seem to have acquired a ~/.local/bin/idris ("no such file or directory"), nor for that matter do I know how to adjust my PATH.
Also, for what it may be worth, I had been warned after the "curl -sSL https://get.haskellstack.org/ | sh" that:
Detected Linux distribution: linuxmint This installer doesn't support your Linux distribution, trying generic bindist... Stack has been installed to: /usr/local/bin/stack Since this installer doesn't support your Linux distribution, there is no guarantee that 'stack' will work at all! You may need to manually install some system info dependencies for GHC: gcc, make, libffi, zlib, libgmp and libtinfo Please see http://docs.haskellstack.org/en/stable/install_and_upgrade/ Pull requests to add support for this distro would be welcome! WARNING: '/home/third/.local/bin' is not on your PATH. For best results, please add it to the beginning of PATH in your profile.
...Sorry to be so completely clueless about the most basic aspects of what's going on, but it really is the state of my knowledge for now!
-------------------------
Date: Tue, 29 Aug 2017 09:08:35 -0400 From: David McBride
To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell Subject: Re: [Haskell-beginners] Installing Idris for Linux Dummies: "The following packages are likely to be broken..." Message-ID: Content-Type: text/plain; charset="UTF-8" The problem most users face with using straight up cabal is that often the needs of one package conflict with the needs of some of the others you've installed. I highly recommend you use stack to install idris. The process should look something like this:
download stack, install it. (directions here: https://docs.haskellstack.org/en/stable/README/) git clone https://github.com/idris-lang/Idris-dev.git cd idris-dev stack install
And then either run ~/.local/bin/idris or make sure .local/bin is in your PATH so that you can run idris on the command line.
On Tue, Aug 29, 2017 at 9:02 AM, Manny Romero
wrote: I am a Linux user (Mint 18) trying to install Idris. I don't know the slightest thing about computers. I barely managed to install Linux, and later the full GHC, based on ample instructions available on the Web. (Still don't actually recall how I did it!)
Idris, however, seems a little trickier. I followed the website (https://www.idris-lang.org/download/)'s instructions:
cabal update cabal install idris
...because apparently I installed "cabal" at some point. But I get this message, which apparently is quite common:
cabal: The following packages are likely to be broken by the reinstalls: semigroupoids-5.1 lens-4.15.1 kan-extensions-5.0.1 profunctors-5.2 comonad-5 bifunctors-5.4.1 Use --force-reinstalls if you want to install anyway.
...those are some of my favorite things! I can't live without them! I am reading things about creating a "sandbox" and so forth. But I cannot use or make sense of this information. I don't know the first thing about cabal; I never use it; I just load everything into GHCI all the time.
Does anyone have some *specific* instructions that I can follow (as "rotely" and dumbly as possible) to get Idris downloaded so I can use it for some beginning studies, without breaking Haskell?
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

participants (5)
-
Brandon Allbery
-
David McBride
-
divyanshu ranjan
-
Manny Romero
-
Shishir Srivastava