Advertisement
Guest User

Untitled

a guest
Jun 18th, 2013
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import qualified Data.ByteString.Char8 as B
  2. import qualified Data.ByteString.Lazy.Char8 as L
  3.  
  4. class PackChar8 s where
  5.   pack :: String -> s
  6.   unpack :: s -> String
  7.  
  8. instance PackChar8 B.ByteString where
  9.   pack = B.pack
  10.   unpack = B.unpack
  11.  
  12. instance PackChar8 L.ByteString where
  13.   pack = L.pack
  14.   unpack = L.unpack
  15.                  
  16.    
  17. id :: (PackChar8 p) => p -> p
  18. id = pack . unpack
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement