Send Beginners mailing list submissions to beginners@haskell.org 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 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: How to include {-# LANGUAGE LambdaCase #-} at the ghci prompt (amin...@mailbox.org) ---------------------------------------------------------------------- Message: 1 Date: Sat, 27 Mar 2021 13:52:35 -0600 From: "amin...@mailbox.org" <amin...@mailbox.org> To: beginners@haskell.org Subject: Re: [Haskell-beginners] How to include {-# LANGUAGE LambdaCase #-} at the ghci prompt Message-ID: <20210327195235.GA21057@painter.painter> 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 Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 152, Issue 10 ******************************************