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
_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime

Reply via email to