[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-cafe
Subject: Re: [Haskell-cafe] Why aren't there anonymous sum types in Haskell?
From: Alexey Khudyakov <alexey.skladnoy () gmail ! com>
Date: 2011-06-21 20:57:49
Message-ID: 4E0105CD.8020201 () gmail ! com
[Download RAW message or body]
On 22.06.2011 00:32, pipoca wrote:
> On Jun 21, 4:15 pm, Alexander Solla<alex.so...@gmail.com> wrote:
>> The problem is that a sum type must "name" the different types, or else it
>> can't give access to them. How is a function supposed to know if a value
>>
>> blah :: A :+: B
>>
>> is an A or a B? It seems possible that it could figure it out, but that
>> problem is undecidable in general.
>
> Why can't you use pattern matching? We'd probably want to change the
> syntax a little, to tell Haskell that we want to use an anonymous sum.
>
> Something like:
>
> foo :: Bar :+: Baz -> Quux
> foo<Bar bar> = ...
> foo<Baz baz> = ...
>
> Would finding the type signature of foo be undecidable?
>
Types may be same.
oops :: Int :+: Int -> Int
oops <Int i> = mmm which one?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic