
The prelude has some issues such like Map.empty, Sequnce.empty, Set.empty It would be much nicer to use class Empty where empty :: a except of more complicated error messages (especially for newbies) Are there already some proposals? Is this the right place to discuss these topics? I got this idea because I'm currently learning more about webfunctions. Some states (eg counters) are implemented using IORefs. I could imagine a class class ModifyIO m c where modify :: IORef a -> ( a -> a ) -> m c data Old a data New a data OldNew a = OldNew a a; modify f = do a <- readIORef io let new = f a writeIORef io new return $ f old new instance ModifyIO IO (Old a) = modify io f = modify io (\old _ -> Old old) instance ModifyIO IO (New a) = modify io f = modify io (\_ new -> New new) instance ModifyIO IO (OldNew a) = modify io f = modify io OldNew which would lead to code such as ... = do (New count) <- modify ioCounterRef (+1) ... compared to ... = do count <- readIORef ioCounterRef let count = count + 1 writeIORef ioCounterRef count ... Do you think this style is insane? Marc Weber