[Haskell-cafe] Showing the 1 element tuple
John Meacham
john at repetae.net
Fri Dec 22 20:09:24 EST 2006
On Fri, Dec 22, 2006 at 11:13:50AM -0800, Dan Weston wrote:
> 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?
HList seems similar to what you are going for:
http://homepages.cwi.nl/~ralf/HList/
John
--
John Meacham - ⑆repetae.net⑆john⑈
More information about the Haskell-Cafe
mailing list