Skip to content

Commit

Permalink
Merge pull request #23 from haskell-works/newhoggy/new-fail-function
Browse files Browse the repository at this point in the history
Newhoggy/new fail function
  • Loading branch information
newhoggy authored Oct 18, 2024
2 parents 45f791f + f82dfb9 commit 50630c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions polysemy/Data/RdsData/Polysemy/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ initialiseDb = withFrozenCallStack do
, " deployed_by TEXT NOT NULL,"
, " CONSTRAINT valid_ulid_constraint"
, " CHECK (ulid::text ~ '^[0-9A-HJKMNP-TV-Z]{26}$')"
, ");"
, ")"
]

executeStatement_
"CREATE INDEX IF NOT EXISTS idx_migration_created_at ON migration (created_at);"
"CREATE INDEX IF NOT EXISTS idx_migration_created_at ON migration (created_at)"

executeStatement_
"CREATE INDEX IF NOT EXISTS idx_migration_deployed_by ON migration (deployed_by);"
"CREATE INDEX IF NOT EXISTS idx_migration_deployed_by ON migration (deployed_by)"
8 changes: 7 additions & 1 deletion src/Data/RdsData/Decode/Value.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ module Data.RdsData.Decode.Value
, uuid
, day

, fail

) where

import Amazonka.Data.Base64
Expand All @@ -54,7 +56,7 @@ import Data.Text (Text)
import Data.Time
import Data.UUID (UUID)
import Data.Word
import Prelude hiding (maybe, null)
import Prelude hiding (fail, maybe, null)

import qualified Amazonka.Data.ByteString as AWS
import qualified Data.Aeson as J
Expand Down Expand Up @@ -87,6 +89,10 @@ instance Monad DecodeValue where
a' <- a v
decodeValue (f a') v

fail :: Text -> DecodeValue a
fail =
DecodeValue . const . Left

--------------------------------------------------------------------------------

rdsValue :: DecodeValue Value
Expand Down

0 comments on commit 50630c6

Please sign in to comment.