mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-22 15:01:39 +03:00
72cfb7fc9b
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5341 GitOrigin-RevId: 39db14cc2d2329d8cadb7a6080b1e2361eba1fb5
23 lines
522 B
Haskell
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
|