graphql-engine/server/src-test/Test/SIString.hs
Evie Ciobanu 72cfb7fc9b server/nada: test mkUpdateCTE
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5341
GitOrigin-RevId: 39db14cc2d2329d8cadb7a6080b1e2361eba1fb5
2022-08-05 21:42:19 +00:00

23 lines
522 B
Haskell

-- | Space Insensitive String.
--
-- Used for things like comparing SQL strings where one of them might be
-- formatted differently for easier reading.
module Test.SIString
( SIString (..),
fromText,
)
where
import Data.Char (isSpace)
import Data.Text qualified as T
import Hasura.Prelude
newtype SIString = SIString {getSIString :: String}
deriving newtype (Show)
fromText :: Text -> SIString
fromText = SIString . T.unpack
instance Eq SIString where
(==) = (==) `on` filter (not . isSpace) . getSIString