[Haskell-cafe] multiline mode on ghci 8.2.2

Jos Kusiek jos.kusiek at tu-dortmund.de
Thu Aug 16 10:58:06 UTC 2018


You need some keyword that triggers Haskell's layout syntax. You end the 
multiline mode with an empty line. In your example you would need the 
"let" keyword.

Prelude> :set +m
Prelude> let square :: Num a => a -> a
Prelude|     square x = x * x
Prelude|
Prelude> square 3
9


On 16.08.2018 11:22, Fabien R wrote:
> I thought I could use the directive ":set +m" to define a function with its signature.
>
> Prelude> :set +m
> Prelude> square :: Num a=>a->a
>
> <interactive>:3:1: error: Variable not in scope: square :: a1 -> a1
>
> Instead, I have to type:
>
> Prelude> :unset +m
> Prelude> :{
> Prelude| square :: Num a=>a->a
> Prelude| square = (^2)
> Prelude| :}
> Prelude>
>
> Any hint ?
>
> --
> Fabien
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.

-- 
Dipl.-Inf. Jos Kusiek

Technische Universität Dortmund
Fakultät 4 - Informatik / Lehrstuhl 1 - Logik in der Informatik
Otto-Hahn-Straße 12, Raum 3.020
44227 Dortmund

Tel.: +49 231-755 7523



More information about the Haskell-Cafe mailing list