encoding/Data/Encoding/ISO88591.hs
Henning Guenther 496761301f Initial commit
darcs-hash:20070802003505-a4fee-97432a586ed2453061ef246d1e7a81fec35d1bac
2007-08-01 17:35:05 -07:00

23 lines
479 B
Haskell

module Data.Encoding.ISO88591
(ISO88591(..)
) where
import Data.Encoding.Base
import Data.ByteString.Base(c2w,w2c)
import Data.Char(ord,chr)
import Data.Word
import Control.Exception
data ISO88591 = ISO88591
enc :: Char -> Word8
enc c = if ord c < 256
then c2w c
else throwDyn (HasNoRepresentation c)
instance Encoding ISO88591 where
encode _ = encodeSinglebyte enc
encodeLazy _ = encodeSinglebyteLazy enc
encodable _ c = ord c < 256
decode _ = decodeSinglebyte w2c