[Haskell-cafe] Lambda-case / lambda-if

Nicolas Pouillard nicolas.pouillard at gmail.com
Tue Oct 5 08:58:19 EDT 2010


On Tue, 5 Oct 2010 03:36:12 -0600, Luke Palmer <lrpalmer at gmail.com> wrote:
> On Mon, Oct 4, 2010 at 9:04 PM, Dean Herington
> <heringtonlacey at mindspring.com> wrote:
> > With respect to "datatype destructing" functions, the Prelude has:
> >
> > maybe :: b -> (a -> b) -> Maybe a -> b
> > either :: (a -> c) -> (b -> c) -> Either a b -> c
> >
> > which suggests the following signatures for the analogues for Bool and list
> > types:
> >
> > bool :: a -> a -> Bool -> a
> > list :: b -> (a -> [a] -> b) -> [a] -> b
> 
> This suggestion is not so clear to me.  Maybe and Either are both
> non-recursive, so the Church and Scott encodings coincide.  You've
> written the Scott encoding of list.  The Church encoding should look
> familiar:
> 
>     list :: b -> (a -> b -> b) -> [a] -> b

I would argue for the previous one (Scott), since we already have this one
(this is foldr with another order for arguments).

-- 
Nicolas Pouillard
http://nicolaspouillard.fr


More information about the Haskell-Cafe mailing list