diff options
| author | adambrangenberg <adabran06@gmail.com> | 2025-12-24 03:40:10 +0100 |
|---|---|---|
| committer | adambrangenberg <adabran06@gmail.com> | 2025-12-24 03:40:10 +0100 |
| commit | a0886694f73fc382d78da79ab8bfb27475757bab (patch) | |
| tree | 652ba9b603a1acaf4dfca188f7bb2c29c6bccfd0 /src/Util.hs | |
| parent | 2b48a574e8b9fed03a5c1969af4bb1e338f1be26 (diff) | |
Implemented basic auth, refactor
Diffstat (limited to 'src/Util.hs')
| -rw-r--r-- | src/Util.hs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Util.hs b/src/Util.hs new file mode 100644 index 0000000..e33e730 --- /dev/null +++ b/src/Util.hs @@ -0,0 +1,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) + |