[Haskell-cafe] Why aren't there anonymous sum types in Haskell?
Anton Nikishaev
anton.nik at gmail.com
Sat Jun 25 18:29:58 CEST 2011
Arlen Cuss <celtic at sairyx.org> writes:
>> import Data.Either
>> type (:|:) a b = Either a b
>> (???) = either
>>
>> foo :: (Int :|: Bool :|: String :|: Double) -> Int
>> foo =
>> \ i -> i + 7 ???
>> \ b -> if b then 1 else 0 ???
>> \ s -> length s ???
>> \ d -> floor d
>
> INFIX TYPE OPERATORS!!??!
>
> O_________________________________________O
Yep.
http://www.haskell.org/ghc/docs/7.0.3/html/users_guide/data-type-extensions.html#infix-tycons
--
lelf
More information about the Haskell-Cafe
mailing list