[Haskell-beginners] Parse error: naked expression at top level

Antoine Latter aslatter at gmail.com
Wed Jul 20 18:42:41 CEST 2011


On Wed, Jul 20, 2011 at 10:50 AM, Roelof Wobben <rwobben at hotmail.com> wrote:
> Oke,
>
> So  In the file I have to load I must put the first 2 lines.
> And in the prompt I have to do the last line,
>
> Or is there a way I can use all three lines in a file ?
>
> Roelof
>

You could say:

> x = replicate 3 True

or:

> main = print (replicate 3 True)

Antoine

>
> ________________________________
> Date: Wed, 20 Jul 2011 11:47:51 -0400
> Subject: Re: [Haskell-beginners] Parse error: naked expression at top level
> From: allbery.b at gmail.com
> To: rwobben at hotmail.com
> CC: beginners at haskell.org
>
> On Wed, Jul 20, 2011 at 11:30, Roelof Wobben <rwobben at hotmail.com> wrote:
>
> replicate :: Int -> a -> [a]
> replicate a xs = [xs | x' <= a <--xs]
>
> replicate 3 True
>
> That last line is fine at a GHCi prompt but not in a program.  (Files loaded
> by ghci are not scripts!  They are treated the same way as program files fed
> to ghc or runhaskell.)
> --
> brandon s allbery                                      allbery.b at gmail.com
> wandering unix systems administrator (available)     (412) 475-9364 vm/sms
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>



More information about the Beginners mailing list