1 {-# LANGUAGE DeriveDataTypeable #-}
2 {-# LANGUAGE FlexibleContexts #-}
3 {-# LANGUAGE FlexibleInstances #-}
4 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
5 {-# LANGUAGE OverloadedStrings #-}
6 {-# LANGUAGE StandaloneDeriving #-}
7 {-# LANGUAGE TypeFamilies #-}
8 {-# OPTIONS_GHC -fno-warn-orphans #-}
9 module Hcompta.Format.JCC.Unit where
11 import Control.DeepSeq
13 import Data.Eq (Eq(..))
14 import Data.Ord (Ord(..))
15 import Data.String (IsString)
16 import Data.Text (Text)
17 import qualified Data.Text as Text
18 import Data.Typeable ()
19 import Prelude ((.), Int)
20 import Text.Show (Show(..))
22 import qualified Hcompta.Unit as Unit
26 newtype Unit = Unit Text
27 deriving (Data, Eq, IsString, Ord, Show, Typeable)
28 instance Unit.Unit Unit where
30 unit_text (Unit t) = t
31 instance NFData Unit where
34 unit_length :: Unit -> Int
35 unit_length = Text.length . Unit.unit_text