]> Git — Sourcephile - comptalang.git/blob - lcc/Hcompta/LCC/Name.hs
Change hcompta-jcc to hcompta-lcc.
[comptalang.git] / lcc / Hcompta / LCC / Name.hs
1 {-# LANGUAGE DeriveDataTypeable #-}
2 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
3 {-# LANGUAGE TypeFamilies #-}
4 {-# OPTIONS_GHC -fno-warn-orphans #-}
5 module Hcompta.LCC.Name where
6
7 import Control.DeepSeq (NFData(..))
8 import Data.Data (Data(..))
9 import Data.Char (Char)
10 import Data.Eq (Eq(..))
11 import qualified Data.MonoTraversable as MT
12 import Data.NonNull (NonNull, toNullable)
13 import Data.Ord (Ord(..))
14 import Data.Text (Text)
15 import Data.Typeable (Typeable)
16 import Text.Show (Show)
17
18 -- * Type 'Name'
19 newtype Name = Name Text
20 deriving (Data, Eq, MT.MonoFoldable, Ord, NFData, Show, Typeable)
21 type instance MT.Element Name = Char
22 instance NFData s => NFData (NonNull s) where
23 rnf s = rnf (toNullable s)
24 unName :: Name -> Text
25 unName (Name n) = n