Module

Ctl.Internal.Helpers

#(</>)

Operator alias for Ctl.Internal.Helpers.appendLastMaybe (right-associative / precedence 5)

#(<<>>)

Operator alias for Ctl.Internal.Helpers.maybeArrayMerge (right-associative / precedence 5)

#(<\>)

Operator alias for Ctl.Internal.Helpers.appendFirstMaybe (right-associative / precedence 5)

#(<</>>)

Operator alias for Ctl.Internal.Helpers.concatPaths (right-associative / precedence 5)

#(??)

Operator alias for Ctl.Internal.Helpers.fromMaybeFlipped (left-associative / precedence 5)

#appendFirstMaybe

appendFirstMaybe :: forall (a :: Type). Maybe a -> Maybe a -> Maybe a

Combine two Maybes taking the First Maybe

#appendLastMaybe

appendLastMaybe :: forall (a :: Type). Maybe a -> Maybe a -> Maybe a

Combine two Maybes taking the Last Maybe

#appendMap

appendMap :: forall (k :: Type) (v :: Type). Ord k => Semigroup v => Map k v -> Map k v -> Map k v

Provide an append for Maps where the value has as Semigroup instance

#appendRightMap

appendRightMap :: forall (k :: Type) (v :: Type). Ord k => Map k v -> Map k v -> Map k v

Provide an append for Maps with right bias

#bigIntToUInt

bigIntToUInt :: BigInt -> Maybe UInt

Converts a BigInt to UInt with potential failure.

#concatPaths

concatPaths :: String -> String -> String

Concat two strings with "/" in the middle, but stripping multiple slashes.

#encodeMap

encodeMap :: forall (k :: Type) (v :: Type). EncodeAeson k => EncodeAeson v => Map k v -> Aeson

If k is encoded as string, encodeMap encodes Map as Object, else as an Array of Aeson /\ Aeson pairs

#encodeTagged

encodeTagged :: forall a. String -> a -> (a -> Aeson) -> Aeson

Args: tag value encoder Encodes value using encoder as { "tag": *encoded tag*, "contents": *encoded value* }

#encodeTagged'

encodeTagged' :: forall (a :: Type). EncodeAeson a => String -> a -> Aeson

A wrapper around encodeTagged function that uses encodeAeson for encoding the passed value

#filterMapM

filterMapM :: forall (m :: Type -> Type) (k :: Type) (v :: Type). Ord k => Monad m => (v -> m Boolean) -> Map k v -> m (Map k v)

Filters a map on a Monadic context over a lifted predicate on the map's value

#filterMapWithKeyM

filterMapWithKeyM :: forall (m :: Type -> Type) (k :: Type) (v :: Type). Ord k => Monad m => (k -> v -> m Boolean) -> Map k v -> m (Map k v)

Filters a map on a Monadic context over a lifted predicate on both the map's key and value

#fromJustEff

fromJustEff :: forall (a :: Type). String -> Maybe a -> Effect a

Throws provided error on Nothing

#fromMaybeFlipped

fromMaybeFlipped :: forall (a :: Type). Maybe a -> a -> a

#fromRightEff

fromRightEff :: forall (a :: Type) (e :: Type). Show e => Either e a -> Effect a

#liftEither

liftEither :: forall (a :: Type) (e :: Type) (m :: Type -> Type). MonadThrow e m => Either e a -> m a

#liftM

liftM :: forall (e :: Type) (m :: Type -> Type) (a :: Type). MonadThrow e m => e -> Maybe a -> m a

Given an error and a Maybe value, lift the context via liftEither.

#liftMWith

liftMWith :: forall (e :: Type) (m :: Type -> Type) (a :: Type) (b :: Type). MonadError e m => e -> (a -> b) -> Maybe a -> m b

Given an error and a Maybe value, lift the context via liftEither with a handler on Right.

#liftedM

liftedM :: forall (e :: Type) (m :: Type -> Type) (a :: Type). MonadError e m => e -> m (Maybe a) -> m a

Given an error and a lifted Maybe value.

#logString

logString :: LogLevel -> LogLevel -> String -> Effect Unit

Log a message from the JS side of the FFI boundary. The first LogLevel argument represents the configured log level (e.g. within QueryConfig). The second argument is the level for this particular message

#logWithLevel

logWithLevel :: forall (m :: Type -> Type). MonadEffect m => LogLevel -> Message -> m Unit

Log a message by printing it to the console, depending on the provided LogLevel

#maybeArrayMerge

maybeArrayMerge :: forall (a :: Type). Eq a => Maybe (Array a) -> Maybe (Array a) -> Maybe (Array a)

Combine two Maybe Array's where Nothing and the empty Array both act as an identity

#mkErrorRecord

mkErrorRecord :: forall (a :: Type). String -> String -> a -> { args :: a, error :: String, errorType :: String }

Used for EncodeAeson for datatype errors

#showWithParens

showWithParens :: forall (a :: Type). Show a => String -> a -> String

Provides Show instances for Newtypes that do not have inner parenthesis, e.g. BigInt. We could optionally use a Newtype constraint for unwrapping, but we don't constrain ourselves by deconstructing the wrapper.

#uIntToBigInt

uIntToBigInt :: UInt -> BigInt

Converts an UInt to BigInt

#pprintTagSet

#eqOrd

eqOrd :: forall a. Ord a => a -> a -> Boolean

#showFromBytes

showFromBytes :: forall a. IsCsl a => IsBytes a => String -> a -> String

#showFromCbor

showFromCbor :: forall a. IsCsl a => IsBytes a => String -> a -> String

#compareViaCslBytes

compareViaCslBytes :: forall a b. IsCsl a => IsBytes a => IsCsl b => IsBytes b => a -> b -> Ordering

#decodeMap

decodeMap :: forall (k :: Type) (v :: Type). DecodeAeson k => Ord k => DecodeAeson v => DecodeTupleAux (k /\ v) => Aeson -> Either JsonDecodeError (Map k v)

#decodeTaggedNewtype

decodeTaggedNewtype :: forall (a :: Type) (b :: Type). DecodeAeson a => String -> (a -> b) -> Aeson -> Either JsonDecodeError b

#unsafeFromJust

unsafeFromJust :: forall a. String -> Maybe a -> a

Modules