encoding/Data/Encoding/ASCII.hs
Henning Guenther eeee054f1e Rewrite to support more sources and changing the encoding dynamically
Now it's possible to change the character encoding while de-/encoding.
Also, it's possible to use any data structure as a source or target of the de-/encoding process.

darcs-hash:20090221203100-a4fee-6da31f2e37c30a3f5cd5f10af71984209488bb0b
2009-02-21 12:31:00 -08:00

17 lines
417 B
Haskell

{-# LANGUAGE DeriveDataTypeable #-}
module Data.Encoding.ASCII where
import Data.Char
import Data.Encoding.Base
import Data.Encoding.ByteSource
import Data.Encoding.ByteSink
import Data.Typeable
data ASCII = ASCII deriving (Show,Eq,Typeable)
instance Encoding ASCII where
decodeChar _ = do
w <- fetchWord8
return $ chr $ fromIntegral w
encodeChar _ c = do
pushWord8 $ fromIntegral $ ord c