Send Beginners mailing list submissions to
        beginners@haskell.org

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
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

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


Today's Topics:

   1. Re:  First version of GHC (Jonas Almstr?m Dureg?rd)
   2.  <- (Patrick Redmond)
   3. Re:  <- (David McBride)
   4. Re:  <- (Tony Morris)
   5. Re:  <- (Karl Voelker)


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

Message: 1
Date: Thu, 30 Aug 2012 17:52:21 +0200
From: Jonas Almstr?m Dureg?rd <jonas.dureg...@chalmers.se>
Subject: Re: [Haskell-beginners] First version of GHC
To: D?niel Arat? <exitcons...@gmail.com>
Cc: beginners@haskell.org
Message-ID:
        <cagngccbv0qdrfm7ppoa3b7c7j1nkfy+x3tebkjphgn8codz...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

According to "A history of Haskell: being lazy with class", the LML
prototype was indeed used to bootstrap the first Haskell version of
GHC.

Regards,
Jonas

On 30 August 2012 17:27, Jonas Almstr?m Dureg?rd
<jonas.dureg...@chalmers.se> wrote:
> Hi,
>
> According to the GHC wikipedia page, a prototype was written in Lazy
> ML. Whether this prototype was used to bootstrap the Haskell version
> is not specified.
>
> Regards,
> Jonas
>
> On 30 August 2012 16:13, D?niel Arat? <exitcons...@gmail.com> wrote:
>> Hi all,
>>
>> I'm curious if the first implementation of GHC was in a different
>> language before its current instance could be developed.
>> If yes, what language was used?
>> If not, what compiler was first used to compile GHC?
>>
>> Thank you,
>> Daniel
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners@haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners



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

Message: 2
Date: Thu, 30 Aug 2012 23:00:52 -0400
From: Patrick Redmond <plredm...@gmail.com>
Subject: [Haskell-beginners] <-
To: Haskell Beginners <beginners@haskell.org>
Message-ID:
        <cahuea4ewrehhe8clypyhoyhmjztw7pz1mvpg1db44+mn93b...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

I'm reading "Learn You a Haskell for Great Good!", chapter 9, "Input
and Output" <http://learnyouahaskell.com/input-and-output>.

IO actions are given liberal coverage throughout the chapter, however
it is never mentioned whether the value-extractor syntax (<-) has a
type or not.

main = do
    x <- getLine
    putStrLn $ reverse x

In this little program, getLine has type "IO String" and x has type
"String". This implies to me that (<-) has type "IO a -> a". However,
GHCI chokes on ":t (<-)" and Hoogle says it's just a syntactic element
<http://www.haskell.org/haskellwiki/Keywords#.3C->.

I guess I don't have a specific question, but I was kind of expecting
it to be a function with a type because everything seems to be a
function with a type in Haskell... Thanks for listening!



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

Message: 3
Date: Thu, 30 Aug 2012 23:09:08 -0400
From: David McBride <toa...@gmail.com>
Subject: Re: [Haskell-beginners] <-
To: Patrick Redmond <plredm...@gmail.com>
Cc: Haskell Beginners <beginners@haskell.org>
Message-ID:
        <can+tr40mewv0dtmrp7yq58wki8nchcx4werurjycrgkoop4...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

It is a syntatic sugar that is expanded to

getLine >>= \x -> putStrLn $ reverse x

>>= is defined in the typeclass for Monad.

In general, if something is using <- notation, it's type is Monad m => m a,
where m could be any of many monads, IO, Maybe, [] (lists), Parser or even
some type of yours that you made an instance of Monad, which you can do if
you would like to use that syntax.

On Thu, Aug 30, 2012 at 11:00 PM, Patrick Redmond <plredm...@gmail.com>wrote:

> I'm reading "Learn You a Haskell for Great Good!", chapter 9, "Input
> and Output" <http://learnyouahaskell.com/input-and-output>.
>
> IO actions are given liberal coverage throughout the chapter, however
> it is never mentioned whether the value-extractor syntax (<-) has a
> type or not.
>
> main = do
>     x <- getLine
>     putStrLn $ reverse x
>
> In this little program, getLine has type "IO String" and x has type
> "String". This implies to me that (<-) has type "IO a -> a". However,
> GHCI chokes on ":t (<-)" and Hoogle says it's just a syntactic element
> <http://www.haskell.org/haskellwiki/Keywords#.3C->.
>
> I guess I don't have a specific question, but I was kind of expecting
> it to be a function with a type because everything seems to be a
> function with a type in Haskell... Thanks for listening!
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20120830/dee5859f/attachment-0001.htm>

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

Message: 4
Date: Fri, 31 Aug 2012 13:10:55 +1000
From: Tony Morris <tonymor...@gmail.com>
Subject: Re: [Haskell-beginners] <-
To: beginners@haskell.org
Message-ID: <50402b3f.8020...@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

The (<-) symbol is syntax, so doesn't really have a type and probably
shouldn't be thought of as having one.

It's more like, given the expression that appears to its right of the
type (m a) implies that the value to its left is of the type a.

Unlike, (->) which has a kind (not a type), since it takes two type
variables to produce a type e.g. (->) Int Int is a function taking Int
to Int.

Hope that helps.


On 31/08/12 13:00, Patrick Redmond wrote:
> I'm reading "Learn You a Haskell for Great Good!", chapter 9, "Input
> and Output" <http://learnyouahaskell.com/input-and-output>.
>
> IO actions are given liberal coverage throughout the chapter, however
> it is never mentioned whether the value-extractor syntax (<-) has a
> type or not.
>
> main = do
>     x <- getLine
>     putStrLn $ reverse x
>
> In this little program, getLine has type "IO String" and x has type
> "String". This implies to me that (<-) has type "IO a -> a". However,
> GHCI chokes on ":t (<-)" and Hoogle says it's just a syntactic element
> <http://www.haskell.org/haskellwiki/Keywords#.3C->.
>
> I guess I don't have a specific question, but I was kind of expecting
> it to be a function with a type because everything seems to be a
> function with a type in Haskell... Thanks for listening!
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners


-- 
Tony Morris
http://tmorris.net/





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

Message: 5
Date: Thu, 30 Aug 2012 20:54:43 -0700
From: Karl Voelker <ktvoel...@gmail.com>
Subject: Re: [Haskell-beginners] <-
To: Patrick Redmond <plredm...@gmail.com>
Cc: Haskell Beginners <beginners@haskell.org>
Message-ID:
        <CAFfow0z2a71hn6z1bO5=v2v0eh_wnb5z3napiivearfp-nf...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

On Thu, Aug 30, 2012 at 8:00 PM, Patrick Redmond <plredm...@gmail.com>wrote:

> IO actions are given liberal coverage throughout the chapter, however
> it is never mentioned whether the value-extractor syntax (<-) has a
> type or not.
>

What sorts of things have types? Values have types, but x <- getLine is not
a value. I will elaborate.


> main = do
>     x <- getLine
>     putStrLn $ reverse x
>
>
As mentioned by others, this can be de-sugared into:

main = getLine >>= \x -> putStrLn $ reverse x


> In this little program, getLine has type "IO String" and x has type
> "String". This implies to me that (<-) has type "IO a -> a". However,
> GHCI chokes on ":t (<-)" and Hoogle says it's just a syntactic element
> <http://www.haskell.org/haskellwiki/Keywords#.3C->.
>

You are right about the types of getLine and x. But look at the part of the
de-sugared code that corresponds to x <- getLine:

getLine >>= \x ->

This isn't an expression. In fact, it's nothing valid on its own. Since you
can't evaluate it to a value, don't expect it to have a type.

I guess I don't have a specific question, but I was kind of expecting
> it to be a function with a type because everything seems to be a
> function with a type in Haskell... Thanks for listening!
>

There are other things in Haskell which don't have a type. Here's something
very similar to your example:

foo = let x = 3 in x + x

Does "let x = 3" have a type? Does the "=" in there have a type? (The
answer is no, and the reasons are basically the same.)

-Karl V.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20120830/d80d3e97/attachment-0001.htm>

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

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 50, Issue 39
*****************************************

Reply via email to