
Hi, I have a rather late suggestion for addition to Haskell. To appease those who I know think that Haskell is over-complicated already and should be having things removed, I'd like to suggest something that I think makes the language rather more consistent, and thus simplifies it despite adding things to it. My suggestion is for a disjunctive tuple syntax using the | symbol. We might right functions as such: fromEither :: Either a b -> (a | b) fromEither (Left x) = (x | ) fromEither (Right x) = ( | x) toEither :: (a | b) -> Either a b toEither (x | ) = Left x toEither ( | x) = Right x makeMoreComplexDisjunction :: Int -> Bool -> Int -> Float -> (Bool | Int | Float) makeMoreComplexDisjunction 1 x _ _ = (x | | ) makeMoreComplexDisjunction 2 _ x _ = ( | x | ) makeMoreComplexDisjunction 3 _ _ x = ( | | x) Using the '|' character gives a nice obvious syntax, and does not (I believe) conflict with anything in the Haskell 98 definition, as '|' is currently reserved for guards. Tom Davie

Thomas Davie wrote:
To appease those who I know think that Haskell is over-complicated already and should be having things removed
I am one of those. But it is interesting that '|' means the same thing here as it does in ADTs. So it does add consistency. On the other hand, if we envision GADTs supplanting ADTs entirely someday, then this will become an anomaly. The disjunctive 2-tuple has a natural monad instance as an exit monad. -Yitz
participants (2)
-
Thomas Davie
-
Yitzchak Gale