Open main menu

Wikibooks β

User:Duplode/Trasnformers refactor

< User:Duplode

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


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