Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/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. Re: How to include {-# LANGUAGE LambdaCase #-} at the ghci
prompt ([email protected])
----------------------------------------------------------------------
Message: 1
Date: Sat, 27 Mar 2021 13:52:35 -0600
From: "[email protected]" <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] How to include {-# LANGUAGE
LambdaCase #-} at the ghci prompt
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
On Fri, Mar 26, 2021 at 06:31:53PM +0100, Francesco Ariis wrote:
> Il 26 marzo 2021 alle 12:20 Galaxy Being ha scritto:
> > I've got this code I've entered into the ghci by hand between :{ and :}
> >
> > :{
> > {-# LANGUAGE LambdaCase #-}
> > data List a = Empty | Cons a (List a) deriving (Eq, Ord, Show)
> > infixr 5 `Cons`
> >
> > subst_c :: (a -> Bool) -> (a, MyList a) -> MyList a
> > subst_c pred = \ case
> > (_, Empty) -> Empty
> > (n, Cons e t)
> > | pred e -> Cons n $ subst_c pred (n, t)
> > | otherwise -> Cons e $ subst_c pred (n, t)
> > :}
> >
>
> λ> :set -XLambdaCase
You can also start GHCi with it:
$ ghci -XLambdaCase
Tom
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 152, Issue 10
******************************************