[Haskell-cafe] Re: having fun with GADT's

David Menendez dave at zednenem.com
Mon Sep 22 23:03:18 EDT 2008


On Mon, Sep 22, 2008 at 10:20 PM, Anatoly Yakovenko
<aeyakovenko at gmail.com> wrote:
>
> Is there a way to define a function that only takes a list with a max
> of 1?  Because
>
> only1 :: MaxList (S a) -> String
> only1 _ = "only1"
>
> will work over
>> a = Cons n02 $ Cons n02 $ Cons n01 $ Nil
> without any problems

only1 :: MaxList (S Z) -> String

If you like, you may declare

type One = S Z
type Two = S One
etc.

-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>


More information about the Haskell-Cafe mailing list