{-# LANGUAGE MultiParamTypeClasses #-}
-- |The instances provide of this Encoding typeclass probably duplicate some
-- functionality of dataenc and encoding libraries from
-- <http://hackage.haskell.org/packages/archive/pkg-list.html>.
module Encoding
    ( Unicode
    , Encoding(..)
    --, Catenable(..)
    , (+++)
    , cat
    ) where

import Data.Monoid

type Unicode = String

-- |A class to facilitate the translation between different encodings
-- of text.  For example, the Text.LaTeX class is an instance of this.
-- The encoded form is a unicode string in which all the LaTeX-special
-- characters are protected, and the text can be included in a LaTeX
-- document and the curly braces will show up as curly braces and so
-- on.
class Encoding medium message where
    encode :: message -> medium
    decode :: medium -> message

(+++) :: Monoid a => a -> a -> a
(+++) = mappend

cat :: Monoid a => [a] -> a
cat = mconcat

{-
class Catenable a where
    cat :: [a] -> a
    (+++) :: a -> a -> a
    a +++ b = cat [a, b]

instance Catenable String where
    cat = concat
-}

