Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 5th, 2012  |  syntax: None  |  size: 0.42 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ByteStrings in Haskell: should I use Put or Builder?
  2. type Put = PutM ()
  3.        
  4. instance (Binary a) => Binary (Colour a) where
  5.     put (Colour r g b) = put r >> put g >> put b
  6.     get = Colour <$> get <*> get <*> get
  7.        
  8. putThing :: Thing -> Put
  9. putThing (Thing thing1 thing2) = do
  10.   putThing1 thing1
  11.   putThing2 thing2
  12.        
  13. putThing :: Thing -> Builder
  14. putThing (Thing thing1 thing2) = mconcat [
  15.   putThing thing1,
  16.   putThing thing2]