{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-} module Hcompta.Model.Amount.Unit where import Data.Data import Data.String (IsString) import qualified Data.Text as Text import Data.Text (Text) import Data.Typeable () newtype Unit = Unit Text deriving (Data, Eq, IsString, Ord, Show, Typeable) -- NOTE: maybe consider using text-show package text :: Unit -> Text text (Unit t) = t nil :: Unit nil = Unit "" length :: Unit -> Int length = Text.length . text