Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Does Haskell work on Free BSD? (KC)
   2. Re:  Does Haskell work on Free BSD? (Mike Meyer)
   3. Re:  Haskeline and forkIO (Peter Jones)
   4. Re:  Haskeline and forkIO (Neeraj Rao)


----------------------------------------------------------------------

Message: 1
Date: Wed, 3 Sep 2014 06:01:18 -0700
From: KC <[email protected]>
To: Haskell Beginners <[email protected]>
Subject: [Haskell-beginners] Does Haskell work on Free BSD?
Message-ID:
        <CAMLKXy=3eyPmpqMBz4VDff+o-heZtSSOi-yO=pcck1m1hqt...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Does Haskell work on Free BSD?

If not which is the better Linux to use?

-- 

--

Sent from an expensive device which will be obsolete in a few months! :D
Casey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140903/7d87d80d/attachment-0001.html>

------------------------------

Message: 2
Date: Wed, 3 Sep 2014 08:12:01 -0500
From: Mike Meyer <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Does Haskell work on Free BSD?
Message-ID:
        <CAD=7u2cv74hpttkhhm3ij1q7_kajku1089rzlkrlwjy97gu...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Haskell works fine on FreeBSD. Both ghc and hugs are available from the
package system. Or you can install the Haskell Platform
(hs-haskell-platform) from it. There are also a variety of Haskell software
packages for development as well as end users.


On Wed, Sep 3, 2014 at 8:01 AM, KC <[email protected]> wrote:

> Does Haskell work on Free BSD?
>
> If not which is the better Linux to use?
>
> --
>
> --
>
> Sent from an expensive device which will be obsolete in a few months! :D
> Casey
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140903/3db4ada1/attachment-0001.html>

------------------------------

Message: 3
Date: Wed, 03 Sep 2014 10:24:55 -0600
From: Peter Jones <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Haskeline and forkIO
Message-ID: <[email protected]>
Content-Type: text/plain

"Jeff C. Britton" <[email protected]> writes:
> That suggestion works.
> I will have to continue learning more about Monads.

I should have also mentioned that if you enable GHC warnings it should
tell you that having the `return` before `loop` is discarding the value
given to it.

> -----Original Message-----
> From: Beginners [mailto:[email protected]]
> Sent: Thursday, August 28, 2014 7:11 AM
> To: [email protected]
> Subject: Re: [Haskell-beginners] Haskeline and forkIO
>
> "Jeff C. Britton" <[email protected]> writes:
>> loop :: InputT IO ()
>> loop = do
>>     maybeLine <- getInputLine "Enter a file to compress> "
>>     case maybeLine of
>>       Nothing -> return ()      -- user entered EOF
>>       Just "" -> return ()      -- treat no name as "want to quit" 
>>       Just path -> do
>>             return (runWorker path)
>>             loop
>
> The other issue you're having is because `runWorker path` is an `IO
> ()` value but at the point where you use it in the code the type
> system wants an `InputT IO ()`.  To try to satisfy the type system you
> used `return` to build a `InputT IO (IO ())` value, but that doesn't
> actually work (as you've noticed).  Since `InputT` is a transformer
> you have an extra layer to work through and so need to *lift* your `IO
> ()` value into the `InputT IO` layer.  Try this:
>
>     -- Add this import
>     import Control.Monad.IO.Class
>     
>     loop :: InputT IO ()
>     loop = do
>         maybeLine <- getInputLine "Enter a file to compress> "
>         case maybeLine of
>           Nothing -> return ()      -- user entered EOF
>           Just "" -> return ()      -- treat no name as "want to quit" 
>           Just path -> do
>                 liftIO (runWorker path)
>                 loop
>     
>
> You can think of `liftIO` as having this signature (in this context):
>
>     liftIO :: IO () -> InputT IO ()

-- 
Peter Jones, Founder, Devalot.com
Defending the honor of good code



------------------------------

Message: 4
Date: Wed, 3 Sep 2014 12:51:50 -0400
From: Neeraj Rao <[email protected]>
To: Peter Jones <[email protected]>,  The Haskell-Beginners Mailing
        List - Discussion of primarily beginner-level topics related to
        Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Haskeline and forkIO
Message-ID:
        <camtpa6anidjp9y1bq_e0gvscxdcysx8baknzzpokyjcs4xo...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

As a Haskell beginner, I would also like to recommend HLint as a very
useful tool to catch these kinds of things.
On Sep 3, 2014 12:25 PM, "Peter Jones" <[email protected]> wrote:

> "Jeff C. Britton" <[email protected]> writes:
> > That suggestion works.
> > I will have to continue learning more about Monads.
>
> I should have also mentioned that if you enable GHC warnings it should
> tell you that having the `return` before `loop` is discarding the value
> given to it.
>
> > -----Original Message-----
> > From: Beginners [mailto:[email protected]]
> > Sent: Thursday, August 28, 2014 7:11 AM
> > To: [email protected]
> > Subject: Re: [Haskell-beginners] Haskeline and forkIO
> >
> > "Jeff C. Britton" <[email protected]> writes:
> >> loop :: InputT IO ()
> >> loop = do
> >>     maybeLine <- getInputLine "Enter a file to compress> "
> >>     case maybeLine of
> >>       Nothing -> return ()      -- user entered EOF
> >>       Just "" -> return ()      -- treat no name as "want to quit"
> >>       Just path -> do
> >>             return (runWorker path)
> >>             loop
> >
> > The other issue you're having is because `runWorker path` is an `IO
> > ()` value but at the point where you use it in the code the type
> > system wants an `InputT IO ()`.  To try to satisfy the type system you
> > used `return` to build a `InputT IO (IO ())` value, but that doesn't
> > actually work (as you've noticed).  Since `InputT` is a transformer
> > you have an extra layer to work through and so need to *lift* your `IO
> > ()` value into the `InputT IO` layer.  Try this:
> >
> >     -- Add this import
> >     import Control.Monad.IO.Class
> >
> >     loop :: InputT IO ()
> >     loop = do
> >         maybeLine <- getInputLine "Enter a file to compress> "
> >         case maybeLine of
> >           Nothing -> return ()      -- user entered EOF
> >           Just "" -> return ()      -- treat no name as "want to quit"
> >           Just path -> do
> >                 liftIO (runWorker path)
> >                 loop
> >
> >
> > You can think of `liftIO` as having this signature (in this context):
> >
> >     liftIO :: IO () -> InputT IO ()
>
> --
> Peter Jones, Founder, Devalot.com
> Defending the honor of good code
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140903/7a807ade/attachment-0001.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 75, Issue 4
****************************************

Reply via email to