
22 Dec
2006
22 Dec
'06
2:13 p.m.
More generally, is there an operator version of dotted pair notation (gasp, did I just lisp?) that works like: data Tuple a b = () | Tuple a b () == () ( ) 1 == Tuple 1 () (2,'a',"hello") == Tuple 2 (Tuple 'a' (Tuple "hello" ())) And is there anyway in Haskell to restrict the type definition above to require that b be a type that can be constructed (possibly recursively) with only () or Tuple, so the user doesn't do something stupid like Tuple 1 'a', which is not a valid dotted pair? Dan John Meacham wrote:
have it be ( ) 1
with a space between the parens to denote that it is a single tuple rather than a nullary one.
John