blob: e33e7303da5e4148e6a5bcc0b58d5cad55a34539 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeSynonymInstances #-}
module Util (Normalisable(..)) where
import Data.Maybe (fromMaybe)
import qualified Data.Text as T
----------------------------------------------------------------------------------------------------
class Normalisable a where
normaliseVariant :: a -> a
instance Normalisable [Char] where
normaliseVariant = T.unpack . normaliseVariant . T.pack
instance Normalisable T.Text where
normaliseVariant str = fromMaybe str (T.stripSuffix (T.pack "'") str)
|