[Haskell-cafe] Re: Wikipedia on first-class object

Cristian Baboi cristi at ot.onrc.ro
Mon Dec 31 06:07:41 EST 2007


Nice! Thank you.

On Mon, 31 Dec 2007 12:56:42 +0200, Ryan Ingram <ryani.spam at gmail.com>  
wrote:

> On 12/30/07, Cristian Baboi <cristi at ot.onrc.ro> wrote:
>>
>> Thank you.
>>
>> data Something = This | S Something
>>
>> ppp :: Something -> String
>>
>> ppp This = ""
>> ppp (S x) = 'S':(ppp x)
>>
>>
>> How can I prevent one to pass  'let x = S x in x' to ppp ?
>
>
>  {-# LANGUAGE GADTs, EmptyDataDecls #-}
> data Z
> data S a
>
> data Something a where
>     This :: Something Z
>     S :: Something a -> Something (S a)
>
> ppp :: Something a -> String
> ppp This =  ""
> ppp (S x) = 'S' : ppp x
>
>




________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
  part000.txt - is OK
http://www.eset.com


More information about the Haskell-Cafe mailing list