User:Duplode/Trasnformers refactor

From Wikibooks, open books for an open world
Jump to navigation Jump to search

A sandbox for composing smaller bits of content for when I'm too lazy to create a new draft page.

foobar


Example: The Collection type class (wrong)

 class Collection c where
     insert :: c -> e -> c
     member :: c -> e -> Bool

 -- Make lists an instance of Collection:
 instance Collection [a] where
     insert xs x = x:xs
     member = flip elem