From a0886694f73fc382d78da79ab8bfb27475757bab Mon Sep 17 00:00:00 2001 From: adambrangenberg Date: Wed, 24 Dec 2025 03:40:10 +0100 Subject: Implemented basic auth, refactor --- src/Util.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/Util.hs (limited to 'src/Util.hs') 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) + -- cgit v1.2.3