You might want to look at the 'get', 'set' and 'update' rules that DrIFT
can derive. i made them to addres a lot of the same issues you
mentioned.

I personally think it is a travesty that 

data Foo = Foo { a :: Int, b :: Char } | Bar { a :: Int }

let x = Bar { a = 4 }
    y = x { b = 'x'} 

results in bottom rather than just leaving x unchanged.

well, travesty is too strong. but it bugs the heck out of me.

but yeah, the DrIFT code derives functions that pull out fields but
returns them in a possibly failing monad so you can properly handle a
data type with no appropriate field.

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈ 
_______________________________________________
Haskell mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to