RE: Haskell update on polymorphic objects

2000-02-09 Thread Mark P Jones
Your example suggests that update was, perhaps, not the best choice of terminology! | data Foo a = Foo { foo :: a |, bar :: Int |} deriving Show | | up s t = s { foo = t } | | Now, what should the type of the function 'up' be? | | up :: Foo a -> a -> Foo a |

Haskell update on polymorphic objects

2000-02-09 Thread Andy Gill
Here is a curiosity of the Haskell update mechanism; you can map one type to another using it. Consider this datatype and function... data Foo a = Foo { foo :: a , bar :: Int } deriving Show up s t = s { foo = t } Now, what should the type of the function 'up