Script.Prelude
- Package
- purescript-spago-script
- Repository
- i-am-the-slime/spago-script
#CmdArgs Source
class CmdArgs :: Symbol -> Symbol -> Constraintclass CmdArgs (command :: Symbol) (args :: Symbol) where
Members
Instances
(IsSymbol args, ValidateCommandArgs command args) => CmdArgs command args
#KnownTemplateArgs Source
class KnownTemplateArgs :: Symbol -> Type -> Constraintclass KnownTemplateArgs (args :: Symbol) input where
Members
templateArgs :: input -> Array String
Instances
(IsSymbol args, ParseTemplate args segments, RenderInput segments input) => KnownTemplateArgs args input
#LsArgs Source
class LsArgs :: Symbol -> Constraintclass LsArgs (args :: Symbol) where
Members
Instances
(IsSymbol args, ValidateLsArgs args) => LsArgs args
#RmArgs Source
class RmArgs :: Symbol -> Constraintclass RmArgs (args :: Symbol) where
Members
Instances
(IsSymbol args, ValidateRmArgs args) => RmArgs args
#ValidateLsArgs Source
class ValidateLsArgs :: Symbol -> Constraintclass ValidateLsArgs args
Instances
ValidateLsArgs ""(Cons head tail args, ValidateLsToken head tail) => ValidateLsArgs args
#ValidateLsPlainToken Source
class ValidateLsPlainToken :: Symbol -> Constraintclass ValidateLsPlainToken args
Instances
ValidateLsPlainToken ""(Cons head tail args, ValidateLsPlainTokenChar head tail) => ValidateLsPlainToken args
#ValidateLsPlainTokenChar Source
class ValidateLsPlainTokenChar :: Symbol -> Symbol -> Constraintclass ValidateLsPlainTokenChar head tail
Instances
(ValidateLsArgs tail) => ValidateLsPlainTokenChar " " tail(ValidateLsPlainToken tail) => ValidateLsPlainTokenChar head tail
#ValidateLsToken Source
class ValidateLsToken :: Symbol -> Symbol -> Constraintclass ValidateLsToken head tail
Instances
(ValidateLsArgs tail) => ValidateLsToken " " tail(ValidateLsFlagToken tail) => ValidateLsToken "-" tail(ValidateLsPlainToken tail) => ValidateLsToken head tail
#ValidateLsFlag Source
class ValidateLsFlag :: Symbol -> Symbol -> Constraintclass ValidateLsFlag head tail
Instances
(ValidateLsArgs tail) => ValidateLsFlag " " tail(ValidateLsFlagToken tail) => ValidateLsFlag "1" tail(ValidateLsFlagToken tail) => ValidateLsFlag "@" tail(ValidateLsFlagToken tail) => ValidateLsFlag "A" tail(ValidateLsFlagToken tail) => ValidateLsFlag "B" tail(ValidateLsFlagToken tail) => ValidateLsFlag "C" tail(ValidateLsFlagToken tail) => ValidateLsFlag "F" tail(ValidateLsFlagToken tail) => ValidateLsFlag "G" tail(ValidateLsFlagToken tail) => ValidateLsFlag "H" tail(ValidateLsFlagToken tail) => ValidateLsFlag "L" tail(ValidateLsFlagToken tail) => ValidateLsFlag "O" tail(ValidateLsFlagToken tail) => ValidateLsFlag "P" tail(ValidateLsFlagToken tail) => ValidateLsFlag "R" tail(ValidateLsFlagToken tail) => ValidateLsFlag "S" tail(ValidateLsFlagToken tail) => ValidateLsFlag "T" tail(ValidateLsFlagToken tail) => ValidateLsFlag "U" tail(ValidateLsFlagToken tail) => ValidateLsFlag "W" tail(ValidateLsFlagToken tail) => ValidateLsFlag "a" tail(ValidateLsFlagToken tail) => ValidateLsFlag "b" tail(ValidateLsFlagToken tail) => ValidateLsFlag "c" tail(ValidateLsFlagToken tail) => ValidateLsFlag "d" tail(ValidateLsFlagToken tail) => ValidateLsFlag "e" tail(ValidateLsFlagToken tail) => ValidateLsFlag "f" tail(ValidateLsFlagToken tail) => ValidateLsFlag "g" tail(ValidateLsFlagToken tail) => ValidateLsFlag "h" tail(ValidateLsFlagToken tail) => ValidateLsFlag "i" tail(ValidateLsFlagToken tail) => ValidateLsFlag "k" tail(ValidateLsFlagToken tail) => ValidateLsFlag "l" tail(ValidateLsFlagToken tail) => ValidateLsFlag "m" tail(ValidateLsFlagToken tail) => ValidateLsFlag "n" tail(ValidateLsFlagToken tail) => ValidateLsFlag "o" tail(ValidateLsFlagToken tail) => ValidateLsFlag "p" tail(ValidateLsFlagToken tail) => ValidateLsFlag "q" tail(ValidateLsFlagToken tail) => ValidateLsFlag "r" tail(ValidateLsFlagToken tail) => ValidateLsFlag "s" tail(ValidateLsFlagToken tail) => ValidateLsFlag "t" tail(ValidateLsFlagToken tail) => ValidateLsFlag "u" tail(ValidateLsFlagToken tail) => ValidateLsFlag "v" tail(ValidateLsFlagToken tail) => ValidateLsFlag "w" tail(ValidateLsFlagToken tail) => ValidateLsFlag "x" tail(Fail (Beside (Text "Illegal ls option: -") (Text flag))) => ValidateLsFlag flag tail
#ValidateLsFlagToken Source
class ValidateLsFlagToken :: Symbol -> Constraintclass ValidateLsFlagToken args
Instances
ValidateLsFlagToken ""(Cons head tail args, ValidateLsFlag head tail) => ValidateLsFlagToken args
#ValidateRmArgs Source
class ValidateRmArgs :: Symbol -> Constraintclass ValidateRmArgs args
Instances
ValidateRmArgs ""(Cons head tail args, ValidateRmToken head tail) => ValidateRmArgs args
#ValidateRmFlag Source
class ValidateRmFlag :: Symbol -> Symbol -> Constraintclass ValidateRmFlag head tail
Instances
(ValidateRmArgs tail) => ValidateRmFlag " " tail(ValidateRmFlagToken tail) => ValidateRmFlag "P" tail(ValidateRmFlagToken tail) => ValidateRmFlag "R" tail(ValidateRmFlagToken tail) => ValidateRmFlag "W" tail(ValidateRmFlagToken tail) => ValidateRmFlag "d" tail(ValidateRmFlagToken tail) => ValidateRmFlag "f" tail(ValidateRmFlagToken tail) => ValidateRmFlag "i" tail(ValidateRmFlagToken tail) => ValidateRmFlag "r" tail(ValidateRmFlagToken tail) => ValidateRmFlag "v" tail(Fail (Beside (Text "Illegal rm option: -") (Text flag))) => ValidateRmFlag flag tail
#ValidateRmFlagToken Source
class ValidateRmFlagToken :: Symbol -> Constraintclass ValidateRmFlagToken args
Instances
ValidateRmFlagToken ""(Cons head tail args, ValidateRmFlag head tail) => ValidateRmFlagToken args
#ValidateRmPlainToken Source
class ValidateRmPlainToken :: Symbol -> Constraintclass ValidateRmPlainToken args
Instances
ValidateRmPlainToken ""(Cons head tail args, ValidateRmPlainTokenChar head tail) => ValidateRmPlainToken args
#ValidateRmPlainTokenChar Source
class ValidateRmPlainTokenChar :: Symbol -> Symbol -> Constraintclass ValidateRmPlainTokenChar head tail
Instances
(ValidateRmArgs tail) => ValidateRmPlainTokenChar " " tail(ValidateRmPlainToken tail) => ValidateRmPlainTokenChar head tail
#ValidateCommandArgs Source
class ValidateCommandArgs :: Symbol -> Symbol -> Constraintclass ValidateCommandArgs command args
Instances
ValidateCommandArgs command ""(Cons head tail args, ValidateCommandToken command head tail) => ValidateCommandArgs command args
#ValidateCommandFlag Source
class ValidateCommandFlag :: Symbol -> Symbol -> Symbol -> Constraintclass ValidateCommandFlag command head tail
Instances
(ValidateCommandArgs command tail) => ValidateCommandFlag command " " tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag command "-" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "cp" "H" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "cp" "L" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "cp" "P" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "cp" "R" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "cp" "X" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "cp" "a" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "cp" "f" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "cp" "i" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "cp" "n" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "cp" "p" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "cp" "v" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "mv" "f" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "mv" "i" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "mv" "n" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "mv" "v" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "mkdir" "m" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "mkdir" "p" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "mkdir" "v" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "A" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "B" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "C" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "E" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "F" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "H" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "I" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "L" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "R" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "V" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "a" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "b" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "c" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "e" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "f" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "h" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "i" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "l" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "m" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "n" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "o" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "q" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "r" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "s" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "v" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "w" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "grep" "x" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "find" "H" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "find" "L" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "find" "P" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "find" "X" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "find" "a" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "find" "d" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "find" "e" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "find" "m" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "find" "n" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "find" "p" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "find" "s" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "find" "t" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "find" "x" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "V" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "b" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "c" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "d" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "f" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "g" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "h" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "i" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "k" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "m" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "n" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "o" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "r" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "s" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "t" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "u" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sort" "z" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "uniq" "c" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "uniq" "d" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "uniq" "f" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "uniq" "i" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "uniq" "s" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "uniq" "u" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "a" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "b" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "c" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "d" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "e" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "f" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "g" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "h" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "i" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "l" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "m" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "n" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "o" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "p" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "q" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "r" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "s" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "t" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "u" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "v" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "w" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "x" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "y" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "git" "z" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "a" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "b" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "c" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "d" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "e" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "f" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "h" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "i" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "l" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "m" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "n" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "o" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "p" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "q" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "r" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "s" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "t" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "u" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "v" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "spago" "x" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "A" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "B" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "C" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "F" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "H" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "I" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "L" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "M" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "N" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "P" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "S" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "U" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "V" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "a" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "c" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "e" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "f" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "g" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "h" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "i" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "j" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "l" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "m" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "n" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "o" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "p" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "q" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "r" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "s" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "t" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "u" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "v" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "w" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "rg" "x" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sed" "E" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sed" "e" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sed" "f" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sed" "i" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sed" "l" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "sed" "n" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "head" "c" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "head" "n" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "head" "q" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "head" "v" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "tail" "F" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "tail" "c" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "tail" "f" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "tail" "n" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "tail" "q" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "tail" "r" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "tail" "v" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "wc" "c" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "wc" "l" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "wc" "m" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "wc" "w" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "tee" "a" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "tee" "i" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "touch" "A" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "touch" "a" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "touch" "c" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "touch" "m" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "touch" "r" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "touch" "t" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "which" "a" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "jj" "h" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "jj" "v" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "gh" "h" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "gh" "v" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "purs" "h" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "purs" "v" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "purs-tidy" "h" tail(ValidateCommandFlagToken command tail) => ValidateCommandFlag "purs-tidy" "v" tail(Fail (Beside (Beside (Text "Illegal option for ") (Text command)) (Beside (Text ": -") (Text flag)))) => ValidateCommandFlag command flag tail
#ValidateCommandFlagToken Source
class ValidateCommandFlagToken :: Symbol -> Symbol -> Constraintclass ValidateCommandFlagToken command args
Instances
ValidateCommandFlagToken command ""(Cons head tail args, ValidateCommandFlag command head tail) => ValidateCommandFlagToken command args
#ValidateCommandPlainToken Source
class ValidateCommandPlainToken :: Symbol -> Symbol -> Constraintclass ValidateCommandPlainToken command args
Instances
ValidateCommandPlainToken command ""(Cons head tail args, ValidateCommandPlainTokenChar command head tail) => ValidateCommandPlainToken command args
#ValidateCommandPlainTokenChar Source
class ValidateCommandPlainTokenChar :: Symbol -> Symbol -> Symbol -> Constraintclass ValidateCommandPlainTokenChar command head tail
Instances
(ValidateCommandArgs command tail) => ValidateCommandPlainTokenChar command " " tail(ValidateCommandPlainToken command tail) => ValidateCommandPlainTokenChar command head tail
#ValidateCommandToken Source
class ValidateCommandToken :: Symbol -> Symbol -> Symbol -> Constraintclass ValidateCommandToken command head tail
Instances
(ValidateCommandArgs command tail) => ValidateCommandToken command " " tail(ValidateCommandFlagToken command tail) => ValidateCommandToken command "-" tail(ValidateCommandPlainToken command tail) => ValidateCommandToken command head tail
#ValidateRmToken Source
class ValidateRmToken :: Symbol -> Symbol -> Constraintclass ValidateRmToken head tail
Instances
(ValidateRmArgs tail) => ValidateRmToken " " tail(ValidateRmFlagToken tail) => ValidateRmToken "-" tail(ValidateRmPlainToken tail) => ValidateRmToken head tail
#SetCookie Source
type SetCookie = { attributes :: Array CookieAttribute, name :: String, value :: String }#ResponseHeaders Source
type ResponseHeaders = Headers#ExecaOptions Source
type ExecaOptions = ExecaOptions#ExecaProcess Source
type ExecaProcess = ExecaProcess#ExecaResult Source
type ExecaResult = ExecaResult#cmdWith Source
cmdWith :: forall m. MonadAff m => String -> (ExecaOptions -> ExecaOptions) -> m ExecaResult#cp Source
cp :: forall @args input m. CmdArgs "cp" args => KnownTemplateArgs args input => MonadAff m => input -> m Unit#execaWith Source
execaWith :: forall args m. ToArgs args => MonadAff m => String -> args -> (ExecaOptions -> ExecaOptions) -> m ExecaResult#grep Source
grep :: forall @args input m. CmdArgs "grep" args => KnownTemplateArgs args input => MonadAff m => input -> m String#gh Source
gh :: forall @args input m. CmdArgs "gh" args => KnownTemplateArgs args input => MonadAff m => input -> m String#head Source
head :: forall @args input m. CmdArgs "head" args => KnownTemplateArgs args input => MonadAff m => input -> m String#jj Source
jj :: forall @args input m. CmdArgs "jj" args => KnownTemplateArgs args input => MonadAff m => input -> m String#joinTextHorizontal Source
joinTextHorizontal :: forall m. MonadEffect m => Array String -> m String#logFmt Source
logFmt :: forall @tmpl segments input m. IsSymbol tmpl => ParseTemplate tmpl segments => RenderInput segments input => MonadEffect m => input -> m Unit#find Source
find :: forall @args input m. CmdArgs "find" args => KnownTemplateArgs args input => MonadAff m => input -> m String#git Source
git :: forall @args input m. CmdArgs "git" args => KnownTemplateArgs args input => MonadAff m => input -> m String#ls Source
ls :: forall @args input m. LsArgs args => KnownTemplateArgs args input => MonadAff m => input -> m String#mv Source
mv :: forall @args input m. CmdArgs "mv" args => KnownTemplateArgs args input => MonadAff m => input -> m Unit#mkdir Source
mkdir :: forall @args input m. CmdArgs "mkdir" args => KnownTemplateArgs args input => MonadAff m => input -> m Unit#purs Source
purs :: forall @args input m. CmdArgs "purs" args => KnownTemplateArgs args input => MonadAff m => input -> m String#pursTidy Source
pursTidy :: forall @args input m. CmdArgs "purs-tidy" args => KnownTemplateArgs args input => MonadAff m => input -> m String#pagerNative Source
pagerNative :: forall m. MonadEffect m => String -> m Unit#readTextFileWith Source
readTextFileWith :: forall m. MonadAff m => Encoding -> FilePath -> m String#rm Source
rm :: forall @args input m. RmArgs args => KnownTemplateArgs args input => MonadAff m => input -> m Unit#runAffWith Source
runAffWith :: forall ctx a. ctx -> Om ctx () a -> Aff a#rg Source
rg :: forall @args input m. CmdArgs "rg" args => KnownTemplateArgs args input => MonadAff m => input -> m String#sed Source
sed :: forall @args input m. CmdArgs "sed" args => KnownTemplateArgs args input => MonadAff m => input -> m String#setCookieHeader Source
setCookieHeader :: SetCookie -> String#sort Source
sort :: forall @args input m. CmdArgs "sort" args => KnownTemplateArgs args input => MonadAff m => input -> m String#spago Source
spago :: forall @args input m. CmdArgs "spago" args => KnownTemplateArgs args input => MonadAff m => input -> m String#spawnPipe Source
spawnPipe :: forall args m. ToArgs args => MonadAff m => String -> args -> m ExecaProcess#spawnWith Source
spawnWith :: forall args m. ToArgs args => MonadAff m => String -> args -> (ExecaOptions -> ExecaOptions) -> m ExecaProcess#stream Source
stream :: ExecaOptions -> ExecaOptions#tableNative Source
tableNative :: forall m. MonadEffect m => Array (Array String) -> m String#tail Source
tail :: forall @args input m. CmdArgs "tail" args => KnownTemplateArgs args input => MonadAff m => input -> m String#tee Source
tee :: forall @args input m. CmdArgs "tee" args => KnownTemplateArgs args input => MonadAff m => input -> m String#touch Source
touch :: forall @args input m. CmdArgs "touch" args => KnownTemplateArgs args input => MonadAff m => input -> m Unit#uniq Source
uniq :: forall @args input m. CmdArgs "uniq" args => KnownTemplateArgs args input => MonadAff m => input -> m String#wc Source
wc :: forall @args input m. CmdArgs "wc" args => KnownTemplateArgs args input => MonadAff m => input -> m String#which Source
which :: forall @args input m. CmdArgs "which" args => KnownTemplateArgs args input => MonadAff m => input -> m String#xWith Source
xWith :: forall args m. ToArgs args => MonadAff m => String -> args -> (ExecaOptions -> ExecaOptions) -> m StringRe-exports from Data.Either
#Either Source
data Either a bThe Either type is used to represent a choice between two types of value.
A common use case for Either is error handling, where Left is used to
carry an error value and Right is used to carry a success value.
Constructors
Instances
Functor (Either a)Generic (Either a b) _Invariant (Either a)Apply (Either e)The
Applyinstance allows functions contained within aRightto transform a value contained within aRightusing the(<*>)operator:Right f <*> Right x == Right (f x)Leftvalues are left untouched:Left f <*> Right x == Left f Right f <*> Left y == Left yCombining
Functor's<$>withApply's<*>can be used to transform a pure function to takeEither-typed arguments sof :: a -> b -> cbecomesf :: Either l a -> Either l b -> Either l c:f <$> Right x <*> Right y == Right (f x y)The
Left-preserving behaviour of both operators means the result of an expression like the above but where any one of the values isLeftmeans the whole result becomesLeftalso, taking the firstLeftvalue found:f <$> Left x <*> Right y == Left x f <$> Right x <*> Left y == Left y f <$> Left x <*> Left y == Left xApplicative (Either e)The
Applicativeinstance enables lifting of values intoEitherwith thepurefunction:pure x :: Either _ _ == Right xCombining
Functor's<$>withApply's<*>andApplicative'spurecan be used to pass a mixture ofEitherand non-Eithertyped values to a function that does not usually expect them, by usingpurefor any value that is not alreadyEithertyped:f <$> Right x <*> pure y == Right (f x y)Even though
pure = Rightit is recommended to usepurein situations like this as it allows the choice ofApplicativeto be changed later without having to go through and replaceRightwith a new constructor.Alt (Either e)The
Altinstance allows for a choice to be made between twoEithervalues with the<|>operator, where the firstRightencountered is taken.Right x <|> Right y == Right x Left x <|> Right y == Right y Left x <|> Left y == Left yBind (Either e)The
Bindinstance allows sequencing ofEithervalues and functions that return anEitherby using the>>=operator:Left x >>= f = Left x Right x >>= f = f xEither's "do notation" can be understood to work like this:x :: forall e a. Either e a x = -- y :: forall e b. Either e b y = -- foo :: forall e a. (a -> b -> c) -> Either e c foo f = do x' <- x y' <- y pure (f x' y')...which is equivalent to...
x >>= (\x' -> y >>= (\y' -> pure (f x' y')))...and is the same as writing...
foo :: forall e a. (a -> b -> c) -> Either e c foo f = case x of Left e -> Left e Right x -> case y of Left e -> Left e Right y -> Right (f x y)Monad (Either e)The
Monadinstance guarantees that there are bothApplicativeandBindinstances forEither.Extend (Either e)The
Extendinstance allows sequencing ofEithervalues and functions that accept anEitherand return a non-Eitherresult using the<<=operator.f <<= Left x = Left x f <<= Right x = Right (f (Right x))(Show a, Show b) => Show (Either a b)The
Showinstance allowsEithervalues to be rendered as a string withshowwhenever there is anShowinstance for both type theEithercan contain.(Eq a, Eq b) => Eq (Either a b)The
Eqinstance allowsEithervalues to be checked for equality with==and inequality with/=whenever there is anEqinstance for both types theEithercan contain.(Eq a) => Eq1 (Either a)(Ord a, Ord b) => Ord (Either a b)The
Ordinstance allowsEithervalues to be compared withcompare,>,>=,<and<=whenever there is anOrdinstance for both types theEithercan contain.Any
Leftvalue is considered to be less than aRightvalue.(Ord a) => Ord1 (Either a)(Bounded a, Bounded b) => Bounded (Either a b)(Semigroup b) => Semigroup (Either a b)
Re-exports from Data.Maybe
#Maybe Source
data Maybe aThe Maybe type is used to represent optional values and can be seen as
something like a type-safe null, where Nothing is null and Just x
is the non-null value x.
Constructors
Instances
Functor MaybeThe
Functorinstance allows functions to transform the contents of aJustwith the<$>operator:f <$> Just x == Just (f x)Nothingvalues are left untouched:f <$> Nothing == NothingApply MaybeThe
Applyinstance allows functions contained within aJustto transform a value contained within aJustusing theapplyoperator:Just f <*> Just x == Just (f x)Nothingvalues are left untouched:Just f <*> Nothing == Nothing Nothing <*> Just x == NothingCombining
Functor's<$>withApply's<*>can be used transform a pure function to takeMaybe-typed arguments sof :: a -> b -> cbecomesf :: Maybe a -> Maybe b -> Maybe c:f <$> Just x <*> Just y == Just (f x y)The
Nothing-preserving behaviour of both operators means the result of an expression like the above but where any one of the values isNothingmeans the whole result becomesNothingalso:f <$> Nothing <*> Just y == Nothing f <$> Just x <*> Nothing == Nothing f <$> Nothing <*> Nothing == NothingApplicative MaybeThe
Applicativeinstance enables lifting of values intoMaybewith thepurefunction:pure x :: Maybe _ == Just xCombining
Functor's<$>withApply's<*>andApplicative'spurecan be used to pass a mixture ofMaybeand non-Maybetyped values to a function that does not usually expect them, by usingpurefor any value that is not alreadyMaybetyped:f <$> Just x <*> pure y == Just (f x y)Even though
pure = Justit is recommended to usepurein situations like this as it allows the choice ofApplicativeto be changed later without having to go through and replaceJustwith a new constructor.Alt MaybeThe
Altinstance allows for a choice to be made between twoMaybevalues with the<|>operator, where the firstJustencountered is taken.Just x <|> Just y == Just x Nothing <|> Just y == Just y Nothing <|> Nothing == NothingPlus MaybeThe
Plusinstance provides a defaultMaybevalue:empty :: Maybe _ == NothingAlternative MaybeThe
Alternativeinstance guarantees that there are bothApplicativeandPlusinstances forMaybe.Bind MaybeThe
Bindinstance allows sequencing ofMaybevalues and functions that return aMaybeby using the>>=operator:Just x >>= f = f x Nothing >>= f = NothingMonad MaybeThe
Monadinstance guarantees that there are bothApplicativeandBindinstances forMaybe. This also enables thedosyntactic sugar:do x' <- x y' <- y pure (f x' y')Which is equivalent to:
x >>= (\x' -> y >>= (\y' -> pure (f x' y')))Which is equivalent to:
case x of Nothing -> Nothing Just x' -> case y of Nothing -> Nothing Just y' -> Just (f x' y')Extend MaybeThe
Extendinstance allows sequencing ofMaybevalues and functions that accept aMaybe aand return a non-Mayberesult using the<<=operator.f <<= Nothing = Nothing f <<= x = Just (f x)Invariant Maybe(Semigroup a) => Semigroup (Maybe a)The
Semigroupinstance enables use of the operator<>onMaybevalues whenever there is aSemigroupinstance for the type theMaybecontains. The exact behaviour of<>depends on the "inner"Semigroupinstance, but generally captures the notion of appending or combining things.Just x <> Just y = Just (x <> y) Just x <> Nothing = Just x Nothing <> Just y = Just y Nothing <> Nothing = Nothing(Semigroup a) => Monoid (Maybe a)(Semiring a) => Semiring (Maybe a)(Eq a) => Eq (Maybe a)The
Eqinstance allowsMaybevalues to be checked for equality with==and inequality with/=whenever there is anEqinstance for the type theMaybecontains.Eq1 Maybe(Ord a) => Ord (Maybe a)The
Ordinstance allowsMaybevalues to be compared withcompare,>,>=,<and<=whenever there is anOrdinstance for the type theMaybecontains.Nothingis considered to be less than anyJustvalue.Ord1 Maybe(Bounded a) => Bounded (Maybe a)(Show a) => Show (Maybe a)The
Showinstance allowsMaybevalues to be rendered as a string withshowwhenever there is anShowinstance for the type theMaybecontains.Generic (Maybe a) _
#maybe Source
maybe :: forall a b. b -> (a -> b) -> Maybe a -> bTakes a default value, a function, and a Maybe value. If the Maybe
value is Nothing the default value is returned, otherwise the function
is applied to the value inside the Just and the result is returned.
maybe x f Nothing == x
maybe x f (Just y) == f y
Re-exports from Effect
#Effect Source
data Effect t0A native effect. The type parameter denotes the return type of running the
effect, that is, an Effect Int is a possibly-effectful computation which
eventually produces a value of the type Int when it finishes.
Instances
Functor EffectApply EffectApplicative EffectBind EffectMonad Effect(Semigroup a) => Semigroup (Effect a)The
Semigroupinstance for effects allows you to run two effects, one after the other, and then combine their results using the result type'sSemigroupinstance.(Monoid a) => Monoid (Effect a)If you have a
Monoid ainstance, thenmempty :: Effect ais defined aspure mempty.
Re-exports from Effect.Aff.Class
#MonadAff Source
class MonadAff :: (Type -> Type) -> Constraintclass (MonadEffect m) <= MonadAff m where
Members
Instances
MonadAff Aff(MonadAff m) => MonadAff (ContT r m)(MonadAff m) => MonadAff (ExceptT e m)(MonadAff m) => MonadAff (ListT m)(MonadAff m) => MonadAff (MaybeT m)(MonadAff m) => MonadAff (ReaderT r m)(MonadAff m, Monoid w) => MonadAff (RWST r w s m)(MonadAff m) => MonadAff (StateT s m)(MonadAff m, Monoid w) => MonadAff (WriterT w m)
Re-exports from Effect.Class
#MonadEffect Source
class MonadEffect :: (Type -> Type) -> Constraintclass (Monad m) <= MonadEffect m where
The MonadEffect class captures those monads which support native effects.
Instances are provided for Effect itself, and the standard monad
transformers.
liftEffect can be used in any appropriate monad transformer stack to lift an
action of type Effect a into the monad.
Members
liftEffect :: forall a. Effect a -> m a
Instances
Re-exports from Fetch.Yoga.Json
Re-exports from Node.Buffer
Re-exports from Node.ChildProcess.Types
#stringSignal Source
stringSignal :: String -> KillSignal#pipe Source
pipe :: StdIOWhen used for X, then Y will exist on the child process where X and Y are
stdio[0]-stdinstdio[1]-stdoutstdio[2]-stderr
Note: when used with stdin, piping the parent stdin to this stream
will not cause the child process to terminate when that parent stdin stream
ends via Ctrl+D user input. Rather, the child process will hang
until the parent process calls Stream.end on the child process'
stdin stream. Since it's impossible to know when the user
inputs Ctrl+D, inherit should be used instead.
#overlapped Source
overlapped :: StdIO#intSignal Source
intSignal :: Int -> KillSignal#inherit Source
inherit :: StdIOUses the parent's corresponding stream.
Note: this value must be used for stdin if one
wants to pipe the parent's stdin into the child process' stdin
AND cause the child process to terminate when the user closes
the parent's stdin via Ctrl+D. Using pipe instead
will cause the child process to hang, even when Ctrl+D is pressed,
until the parent process calls Stream.end, which cannot be reliably
called the moment AFTER Ctrl+D is pressed.
#fileDescriptor Source
fileDescriptor :: Int -> StdIO#enableShell Source
enableShell :: Shell#customShell Source
customShell :: String -> ShellRe-exports from Node.Encoding
Re-exports from Node.FS.Stats
Re-exports from Node.Path
Re-exports from Prelude
#Void Source
newtype VoidAn uninhabited data type. In other words, one can never create
a runtime value of type Void because no such value exists.
Void is useful to eliminate the possibility of a value being created.
For example, a value of type Either Void Boolean can never have
a Left value created in PureScript.
This should not be confused with the keyword void that commonly appears in
C-family languages, such as Java:
public class Foo {
void doSomething() { System.out.println("hello world!"); }
}
In PureScript, one often uses Unit to achieve similar effects as
the void of C-family languages above.
#Unit Source
data UnitThe Unit type has a single inhabitant, called unit. It represents
values with no computational content.
Unit is often used, wrapped in a monadic type constructor, as the
return type of a computation where only the effects are important.
When returning a value of type Unit from an FFI function, it is
recommended to use undefined, or not return a value at all.
#Ordering Source
data OrderingThe Ordering data type represents the three possible outcomes of
comparing two values:
LT - The first value is less than the second.
GT - The first value is greater than the second.
EQ - The first value is equal to the second.
Constructors
Instances
#Applicative Source
class Applicative :: (Type -> Type) -> Constraintclass (Apply f) <= Applicative f where
The Applicative type class extends the Apply type class
with a pure function, which can be used to create values of type f a
from values of type a.
Where Apply provides the ability to lift functions of two or
more arguments to functions whose arguments are wrapped using f, and
Functor provides the ability to lift functions of one
argument, pure can be seen as the function which lifts functions of
zero arguments. That is, Applicative functors support a lifting
operation for any number of function arguments.
Instances must satisfy the following laws in addition to the Apply
laws:
- Identity:
(pure identity) <*> v = v - Composition:
pure (<<<) <*> f <*> g <*> h = f <*> (g <*> h) - Homomorphism:
(pure f) <*> (pure x) = pure (f x) - Interchange:
u <*> (pure y) = (pure (_ $ y)) <*> u
Members
pure :: forall a. a -> f a
Instances
#Apply Source
class Apply :: (Type -> Type) -> Constraintclass (Functor f) <= Apply f where
The Apply class provides the (<*>) which is used to apply a function
to an argument under a type constructor.
Apply can be used to lift functions of two or more arguments to work on
values wrapped with the type constructor f. It might also be understood
in terms of the lift2 function:
lift2 :: forall f a b c. Apply f => (a -> b -> c) -> f a -> f b -> f c
lift2 f a b = f <$> a <*> b
(<*>) is recovered from lift2 as lift2 ($). That is, (<*>) lifts
the function application operator ($) to arguments wrapped with the
type constructor f.
Put differently...
foo =
functionTakingNArguments <$> computationProducingArg1
<*> computationProducingArg2
<*> ...
<*> computationProducingArgN
Instances must satisfy the following law in addition to the Functor
laws:
- Associative composition:
(<<<) <$> f <*> g <*> h = f <*> (g <*> h)
Formally, Apply represents a strong lax semi-monoidal endofunctor.
Members
apply :: forall a b. f (a -> b) -> f a -> f b
Instances
#Bind Source
class Bind :: (Type -> Type) -> Constraintclass (Apply m) <= Bind m where
The Bind type class extends the Apply type class with a
"bind" operation (>>=) which composes computations in sequence, using
the return value of one computation to determine the next computation.
The >>= operator can also be expressed using do notation, as follows:
x >>= f = do y <- x
f y
where the function argument of f is given the name y.
Instances must satisfy the following laws in addition to the Apply
laws:
- Associativity:
(x >>= f) >>= g = x >>= (\k -> f k >>= g) - Apply Superclass:
apply f x = f >>= \f’ -> map f’ x
Associativity tells us that we can regroup operations which use do
notation so that we can unambiguously write, for example:
do x <- m1
y <- m2 x
m3 x y
Members
bind :: forall a b. m a -> (a -> m b) -> m b
Instances
Bind (Function r)Bind ArrayThe
bind/>>=function forArrayworks by applying a function to each element in the array, and flattening the results into a single, new array.Array's
bind/>>=works like a nested for loop. Eachbindadds another level of nesting in the loop. For example:foo :: Array String foo = ["a", "b"] >>= \eachElementInArray1 -> ["c", "d"] >>= \eachElementInArray2 pure (eachElementInArray1 <> eachElementInArray2) -- In other words... foo -- ... is the same as... [ ("a" <> "c"), ("a" <> "d"), ("b" <> "c"), ("b" <> "d") ] -- which simplifies to... [ "ac", "ad", "bc", "bd" ]Bind Proxy
#BooleanAlgebra Source
class (HeytingAlgebra a) <= BooleanAlgebra a The BooleanAlgebra type class represents types that behave like boolean
values.
Instances should satisfy the following laws in addition to the
HeytingAlgebra law:
- Excluded middle:
a || not a = tt
Instances
BooleanAlgebra BooleanBooleanAlgebra Unit(BooleanAlgebra b) => BooleanAlgebra (a -> b)(RowToList row list, BooleanAlgebraRecord list row row) => BooleanAlgebra (Record row)BooleanAlgebra (Proxy a)
#Bounded Source
class (Ord a) <= Bounded a whereThe Bounded type class represents totally ordered types that have an
upper and lower boundary.
Instances should satisfy the following law in addition to the Ord laws:
- Bounded:
bottom <= a <= top
Members
Instances
Bounded BooleanBounded IntThe
BoundedIntinstance hastop :: Intequal to 2^31 - 1, andbottom :: Intequal to -2^31, since these are the largest and smallest integers representable by twos-complement 32-bit integers, respectively.Bounded CharCharacters fall within the Unicode range.
Bounded OrderingBounded UnitBounded NumberBounded (Proxy a)(RowToList row list, BoundedRecord list row row) => Bounded (Record row)
#Category Source
class Category :: forall k. (k -> k -> Type) -> Constraintclass (Semigroupoid a) <= Category a where
Categorys consist of objects and composable morphisms between them, and
as such are Semigroupoids, but unlike semigroupoids
must have an identity element.
Instances must satisfy the following law in addition to the
Semigroupoid law:
- Identity:
identity <<< p = p <<< identity = p
Members
identity :: forall t. a t t
Instances
#CommutativeRing Source
class (Ring a) <= CommutativeRing a The CommutativeRing class is for rings where multiplication is
commutative.
Instances must satisfy the following law in addition to the Ring
laws:
- Commutative multiplication:
a * b = b * a
Instances
CommutativeRing IntCommutativeRing NumberCommutativeRing Unit(CommutativeRing b) => CommutativeRing (a -> b)(RowToList row list, CommutativeRingRecord list row row) => CommutativeRing (Record row)CommutativeRing (Proxy a)
#DivisionRing Source
class (Ring a) <= DivisionRing a whereThe DivisionRing class is for non-zero rings in which every non-zero
element has a multiplicative inverse. Division rings are sometimes also
called skew fields.
Instances must satisfy the following laws in addition to the Ring laws:
- Non-zero ring:
one /= zero - Non-zero multiplicative inverse:
recip a * a = a * recip a = onefor all non-zeroa
The result of recip zero is left undefined; individual instances may
choose how to handle this case.
If a type has both DivisionRing and CommutativeRing instances, then
it is a field and should have a Field instance.
Members
recip :: a -> a
Instances
#Eq Source
class Eq a whereThe Eq type class represents types which support decidable equality.
Eq instances should satisfy the following laws:
- Reflexivity:
x == x = true - Symmetry:
x == y = y == x - Transitivity: if
x == yandy == zthenx == z
Note: The Number type is not an entirely law abiding member of this
class due to the presence of NaN, since NaN /= NaN. Additionally,
computing with Number can result in a loss of precision, so sometimes
values that should be equivalent are not.
Members
Instances
#EuclideanRing Source
class (CommutativeRing a) <= EuclideanRing a whereThe EuclideanRing class is for commutative rings that support division.
The mathematical structure this class is based on is sometimes also called
a Euclidean domain.
Instances must satisfy the following laws in addition to the Ring
laws:
- Integral domain:
one /= zero, and ifaandbare both nonzero then so is their producta * b - Euclidean function
degree:- Nonnegativity: For all nonzero
a,degree a >= 0 - Quotient/remainder: For all
aandb, wherebis nonzero, letq = a / bandr = a `mod` b; thena = q*b + r, and also eitherr = zeroordegree r < degree b
- Nonnegativity: For all nonzero
- Submultiplicative euclidean function:
- For all nonzero
aandb,degree a <= degree (a * b)
- For all nonzero
The behaviour of division by zero is unconstrained by these laws,
meaning that individual instances are free to choose how to behave in this
case. Similarly, there are no restrictions on what the result of
degree zero is; it doesn't make sense to ask for degree zero in the
same way that it doesn't make sense to divide by zero, so again,
individual instances may choose how to handle this case.
For any EuclideanRing which is also a Field, one valid choice
for degree is simply const 1. In fact, unless there's a specific
reason not to, Field types should normally use this definition of
degree.
The EuclideanRing Int instance is one of the most commonly used
EuclideanRing instances and deserves a little more discussion. In
particular, there are a few different sensible law-abiding implementations
to choose from, with slightly different behaviour in the presence of
negative dividends or divisors. The most common definitions are "truncating"
division, where the result of a / b is rounded towards 0, and "Knuthian"
or "flooring" division, where the result of a / b is rounded towards
negative infinity. A slightly less common, but arguably more useful, option
is "Euclidean" division, which is defined so as to ensure that a `mod` b
is always nonnegative. With Euclidean division, a / b rounds towards
negative infinity if the divisor is positive, and towards positive infinity
if the divisor is negative. Note that all three definitions are identical if
we restrict our attention to nonnegative dividends and divisors.
In versions 1.x, 2.x, and 3.x of the Prelude, the EuclideanRing Int
instance used truncating division. As of 4.x, the EuclideanRing Int
instance uses Euclidean division. Additional functions quot and rem are
supplied if truncating division is desired.
Members
Instances
#Field Source
class (EuclideanRing a, DivisionRing a) <= Field a The Field class is for types that are (commutative) fields.
Mathematically, a field is a ring which is commutative and in which every
nonzero element has a multiplicative inverse; these conditions correspond
to the CommutativeRing and DivisionRing classes in PureScript
respectively. However, the Field class has EuclideanRing and
DivisionRing as superclasses, which seems like a stronger requirement
(since CommutativeRing is a superclass of EuclideanRing). In fact, it
is not stronger, since any type which has law-abiding CommutativeRing
and DivisionRing instances permits exactly one law-abiding
EuclideanRing instance. We use a EuclideanRing superclass here in
order to ensure that a Field constraint on a function permits you to use
div on that type, since div is a member of EuclideanRing.
This class has no laws or members of its own; it exists as a convenience, so a single constraint can be used when field-like behaviour is expected.
This module also defines a single Field instance for any type which has
both EuclideanRing and DivisionRing instances. Any other instance
would overlap with this instance, so no other Field instances should be
defined in libraries. Instead, simply define EuclideanRing and
DivisionRing instances, and this will permit your type to be used with a
Field constraint.
Instances
(EuclideanRing a, DivisionRing a) => Field a
#Functor Source
class Functor :: (Type -> Type) -> Constraintclass Functor f where
A Functor is a type constructor which supports a mapping operation
map.
map can be used to turn functions a -> b into functions
f a -> f b whose argument and return types use the type constructor f
to represent some computational context.
Instances must satisfy the following laws:
- Identity:
map identity = identity - Composition:
map (f <<< g) = map f <<< map g
Members
map :: forall a b. (a -> b) -> f a -> f b
Instances
#HeytingAlgebra Source
class HeytingAlgebra a whereThe HeytingAlgebra type class represents types that are bounded lattices with
an implication operator such that the following laws hold:
- Associativity:
a || (b || c) = (a || b) || ca && (b && c) = (a && b) && c
- Commutativity:
a || b = b || aa && b = b && a
- Absorption:
a || (a && b) = aa && (a || b) = a
- Idempotent:
a || a = aa && a = a
- Identity:
a || ff = aa && tt = a
- Implication:
a `implies` a = tta && (a `implies` b) = a && bb && (a `implies` b) = ba `implies` (b && c) = (a `implies` b) && (a `implies` c)
- Complemented:
not a = a `implies` ff
Members
Instances
HeytingAlgebra BooleanHeytingAlgebra Unit(HeytingAlgebra b) => HeytingAlgebra (a -> b)HeytingAlgebra (Proxy a)(RowToList row list, HeytingAlgebraRecord list row row) => HeytingAlgebra (Record row)
#Monad Source
class Monad :: (Type -> Type) -> Constraintclass (Applicative m, Bind m) <= Monad m
The Monad type class combines the operations of the Bind and
Applicative type classes. Therefore, Monad instances represent type
constructors which support sequential composition, and also lifting of
functions of arbitrary arity.
Instances must satisfy the following laws in addition to the
Applicative and Bind laws:
- Left Identity:
pure x >>= f = f x - Right Identity:
x >>= pure = x
Instances
#Monoid Source
class (Semigroup m) <= Monoid m whereA Monoid is a Semigroup with a value mempty, which is both a
left and right unit for the associative operation <>:
- Left unit:
(mempty <> x) = x - Right unit:
(x <> mempty) = x
Monoids are commonly used as the result of fold operations, where
<> is used to combine individual results, and mempty gives the result
of folding an empty collection of elements.
Newtypes for Monoid
Some types (e.g. Int, Boolean) can implement multiple law-abiding
instances for Monoid. Let's use Int as an example
<>could be+andmemptycould be0<>could be*andmemptycould be1.
To clarify these ambiguous situations, one should use the newtypes
defined in Data.Monoid.<NewtypeName> modules.
In the above ambiguous situation, we could use Additive
for the first situation or Multiplicative for the second one.
Members
mempty :: m
Instances
#Ord Source
class (Eq a) <= Ord a whereThe Ord type class represents types which support comparisons with a
total order.
Ord instances should satisfy the laws of total orderings:
- Reflexivity:
a <= a - Antisymmetry: if
a <= bandb <= athena == b - Transitivity: if
a <= bandb <= cthena <= c
Note: The Number type is not an entirely law abiding member of this
class due to the presence of NaN, since NaN <= NaN evaluates to false
Members
Instances
#Ring Source
class (Semiring a) <= Ring a whereThe Ring class is for types that support addition, multiplication,
and subtraction operations.
Instances must satisfy the following laws in addition to the Semiring
laws:
- Additive inverse:
a - a = zero - Compatibility of
subandnegate:a - b = a + (zero - b)
Members
sub :: a -> a -> a
Instances
#Semigroup Source
class Semigroup a The Semigroup type class identifies an associative operation on a type.
Instances are required to satisfy the following law:
- Associativity:
(x <> y) <> z = x <> (y <> z)
One example of a Semigroup is String, with (<>) defined as string
concatenation. Another example is List a, with (<>) defined as
list concatenation.
Newtypes for Semigroup
There are two other ways to implement an instance for this type class regardless of which type is used. These instances can be used by wrapping the values in one of the two newtypes below:
First- Use the first argument every time:append first _ = first.Last- Use the last argument every time:append _ last = last.
Instances
#Semigroupoid Source
class Semigroupoid :: forall k. (k -> k -> Type) -> Constraintclass Semigroupoid a where
A Semigroupoid is similar to a Category but does not
require an identity element identity, just composable morphisms.
Semigroupoids must satisfy the following law:
- Associativity:
p <<< (q <<< r) = (p <<< q) <<< r
One example of a Semigroupoid is the function type constructor (->),
with (<<<) defined as function composition.
Members
compose :: forall b c d. a c d -> a b c -> a b d
Instances
#Semiring Source
class Semiring a whereThe Semiring class is for types that support an addition and
multiplication operation.
Instances must satisfy the following laws:
- Commutative monoid under addition:
- Associativity:
(a + b) + c = a + (b + c) - Identity:
zero + a = a + zero = a - Commutative:
a + b = b + a
- Associativity:
- Monoid under multiplication:
- Associativity:
(a * b) * c = a * (b * c) - Identity:
one * a = a * one = a
- Associativity:
- Multiplication distributes over addition:
- Left distributivity:
a * (b + c) = (a * b) + (a * c) - Right distributivity:
(a + b) * c = (a * c) + (b * c)
- Left distributivity:
- Annihilation:
zero * a = a * zero = zero
Note: The Number and Int types are not fully law abiding
members of this class hierarchy due to the potential for arithmetic
overflows, and in the case of Number, the presence of NaN and
Infinity values. The behaviour is unspecified in these cases.
Members
Instances
#Show Source
class Show a whereThe Show type class represents those types which can be converted into
a human-readable String representation.
While not required, it is recommended that for any expression x, the
string show x be executable PureScript code which evaluates to the same
value as the expression x.
Members
Instances
#when Source
when :: forall m. Applicative m => Boolean -> m Unit -> m UnitPerform an applicative action when a condition is true.
#void Source
void :: forall f a. Functor f => f a -> f UnitThe void function is used to ignore the type wrapped by a
Functor, replacing it with Unit and keeping only the type
information provided by the type constructor itself.
void is often useful when using do notation to change the return type
of a monadic computation:
main = forE 1 10 \n -> void do
print n
print (n * n)
#unless Source
unless :: forall m. Applicative m => Boolean -> m Unit -> m UnitPerform an applicative action unless a condition is true.
#liftM1 Source
liftM1 :: forall m a b. Monad m => (a -> b) -> m a -> m bliftM1 provides a default implementation of (<$>) for any
Monad, without using (<$>) as provided by the
Functor-Monad superclass relationship.
liftM1 can therefore be used to write Functor instances
as follows:
instance functorF :: Functor F where
map = liftM1
#liftA1 Source
liftA1 :: forall f a b. Applicative f => (a -> b) -> f a -> f bliftA1 provides a default implementation of (<$>) for any
Applicative functor, without using (<$>) as provided
by the Functor-Applicative superclass
relationship.
liftA1 can therefore be used to write Functor instances
as follows:
instance functorF :: Functor F where
map = liftA1
#lcm Source
lcm :: forall a. Eq a => EuclideanRing a => a -> a -> aThe least common multiple of two values.
#gcd Source
gcd :: forall a. Eq a => EuclideanRing a => a -> a -> aThe greatest common divisor of two values.
#flip Source
flip :: forall a b c. (a -> b -> c) -> b -> a -> cGiven a function that takes two arguments, applies the arguments to the function in a swapped order.
flip append "1" "2" == append "2" "1" == "21"
const 1 "two" == 1
flip const 1 "two" == const "two" 1 == "two"
#flap Source
flap :: forall f a b. Functor f => f (a -> b) -> a -> f bApply a value in a computational context to a value in no context.
Generalizes flip.
longEnough :: String -> Bool
hasSymbol :: String -> Bool
hasDigit :: String -> Bool
password :: String
validate :: String -> Array Bool
validate = flap [longEnough, hasSymbol, hasDigit]
flap (-) 3 4 == 1
threeve <$> Just 1 <@> 'a' <*> Just true == Just (threeve 1 'a' true)
#const Source
const :: forall a b. a -> b -> aReturns its first argument and ignores its second.
const 1 "hello" = 1
It can also be thought of as creating a function that ignores its argument:
const 1 = \_ -> 1
#(>>>) Source
Operator alias for Control.Semigroupoid.composeFlipped (right-associative / precedence 9)
#(<=<) Source
Operator alias for Control.Bind.composeKleisliFlipped (right-associative / precedence 1)
#($) Source
Operator alias for Data.Function.apply (right-associative / precedence 0)
Applies a function to an argument: the reverse of (#).
length $ groupBy productCategory $ filter isInStock $ products
is equivalent to:
length (groupBy productCategory (filter isInStock products))
Or another alternative equivalent, applying chain of composed functions to a value:
length <<< groupBy productCategory <<< filter isInStock $ products
#(#) Source
Operator alias for Data.Function.applyFlipped (left-associative / precedence 1)
Applies an argument to a function: the reverse of ($).
products # filter isInStock # groupBy productCategory # length
is equivalent to:
length (groupBy productCategory (filter isInStock products))
Or another alternative equivalent, applying a value to a chain of composed functions:
products # filter isInStock >>> groupBy productCategory >>> length
#type (~>) Source
Operator alias for Data.NaturalTransformation.NaturalTransformation (right-associative / precedence 4)
Re-exports from Yoga.Fetch
#statusCode Source
statusCode :: Response -> Int#postMethod Source
postMethod :: Method#makeHeaders Source
makeHeaders :: forall r. Homogeneous r String => Record r -> Headers#headMethod Source
headMethod :: Method#defaultFetchOptions Source
defaultFetchOptions :: { method :: Method }#arrayBuffer Source
arrayBuffer :: Response -> Aff ArrayBufferRe-exports from Yoga.Fetch.Om
#DeriveClient Source
class DeriveClient :: Row Type -> Row Type -> Constraintclass DeriveClient routesRow clientsRow | routesRow -> clientsRow where
Members
deriveClientImpl :: String -> Proxy (Record routesRow) -> Record clientsRow
Instances
(RowToList routesRow rl, DeriveClientRL rl () clientsRow) => DeriveClient routesRow clientsRow
#DeriveClientFn Source
class DeriveClientFn :: forall k1. Type -> k1 -> Type -> Row Type -> Row Type -> Row Type -> Type -> Type -> Constraintclass DeriveClientFn method segments request response routeErrors successRow result fn | method segments request response -> routeErrors successRow result fn where
Members
deriveClientFn :: String -> Proxy (Route method segments request response) -> fn
Instances
(SegmentPathParams segments pathParams, SegmentQueryParams segments queryParams, ExtractRequestBody request body, ExtractBodyEncoding request encoding, ExtractRequestHeaders request headers, PathPattern segments, BuildUrl segments pathParams queryParams, MakeRequest method, BodyEncoding encoding body, SplitResponses response successRow routeErrors, ParseResponse routeErrors successRow, RowToList successRow successRL, VariantOrValue successRL successRow result, Union pathParams queryParams pathQuery, Nub pathQuery pathQuery, RowToList pathQuery pathQueryRL, RowToList headers headersRL, ToHeaders headersRL headers, CheckBodyIsUnit body bodyFlag, BuildClientFn pathQueryRL headersRL bodyFlag body pathQuery headers routeErrors result fn) => DeriveClientFn method segments request response routeErrors successRow result fn
#DeriveClientRL Source
class DeriveClientRL :: RowList Type -> Row Type -> Row Type -> Constraintclass DeriveClientRL rl acc out | rl acc -> out where
Members
deriveClientRL :: String -> Proxy rl -> Record acc -> Record out
Instances
DeriveClientRL Nil acc acc(IsSymbol label, DeriveClientFn method segments request response routeErrors successRow result fn, DeriveClientRL tail acc1 acc2, Cons label fn acc2 out, Lacks label acc2, Cons label (Route method segments request response) routeTail routeRow) => DeriveClientRL (Cons label (Route method segments request response) tail) acc1 out
#deriveClient Source
deriveClient :: forall @routesRow clientsRow polyClientsRow. DeriveClient routesRow clientsRow => String -> Record polyClientsRowDeprecated: Use client with VTA instead
api = deriveClient @UserAPI "https://api.example.com"
#client Source
client :: forall @routes routesRow clientsRow polyClientsRow. RecordRow routes routesRow => DeriveClient routesRow clientsRow => String -> Record polyClientsRowDerive API client functions from route definitions using VTA
type UserAPI = { getUser :: Route ... }
api = client @UserAPI "https://api.example.com"
Re-exports from Yoga.Format
#format Source
format :: forall @tmpl segments input. IsSymbol tmpl => ParseTemplate tmpl segments => RenderInput segments input => input -> String#fmt Source
fmt :: forall @tmpl segments input. IsSymbol tmpl => ParseTemplate tmpl segments => RenderInput segments input => input -> StringRe-exports from Yoga.JSON
#E Source
type E a = Either MultipleErrors aAn alias for the Either result of decoding
#ReadForeign Source
class ReadForeign a whereA class for reading foreign values to a type
Members
Instances
ReadForeign ForeignReadForeign CharReadForeign NumberReadForeign IntReadForeign BigIntReadForeign StringReadForeign NonEmptyStringReadForeign Boolean(ReadForeign a) => ReadForeign (Array a)(ReadForeign a) => ReadForeign (Maybe a)(ReadForeign a) => ReadForeign (Nullable a)(ReadForeign a, ReadForeign b) => ReadForeign (Either a b)(ReadForeign a) => ReadForeign (Object a)(ReadTuple (Tuple a b)) => ReadForeign (Tuple a b)(RowToList fields fieldList, ReadForeignFields fieldList () fields) => ReadForeign (Record fields)(RowToList variants rl, ReadForeignVariant rl variants) => ReadForeign (Variant variants)(ReadForeign a) => ReadForeign (NonEmptyArray a)(ReadForeign a) => ReadForeign (Map String a)(ReadForeign a) => ReadForeign (Map Int a)(ReadForeign a) => ReadForeign (Map BigInt a)(Newtype nt key, ReadForeign (Map key value)) => ReadForeign (Map nt value)(Ord a, ReadForeign a) => ReadForeign (Set a)ReadForeign JSDateReadForeign DateTimeReadForeign InstantReadForeign MillisecondsReadForeign SecondsReadForeign MinutesReadForeign HoursReadForeign Days(ReadForeign a) => ReadForeign (Tree a)
#ReadForeignFields Source
class ReadForeignFields :: RowList Type -> Row Type -> Row Type -> Constraintclass ReadForeignFields (xs :: RowList Type) (from :: Row Type) (to :: Row Type) | xs -> from to where
A class for reading foreign values from properties
Members
Instances
(IsSymbol name, ReadForeign ty, ReadForeignFields tail from from', Lacks name from', Cons name ty from' to) => ReadForeignFields (Cons name ty tail) from toReadForeignFields Nil () ()
#ReadForeignVariant Source
class ReadForeignVariant :: RowList Type -> Row Type -> Constraintclass ReadForeignVariant (xs :: RowList Type) (row :: Row Type) | xs -> row where
Members
readVariantImpl :: Proxy xs -> Foreign -> F (Variant row)
Instances
(IsSymbol name, ReadForeign ty, Cons name ty trash row, ReadForeignVariant tail row) => ReadForeignVariant (Cons name ty tail) rowReadForeignVariant Nil trash
#ReadTuple Source
class ReadTuple a whereA class for reading JSON arrays of lenth n as nested tuples of size n
Members
Instances
(ReadForeign a, ReadTuple (Tuple b c)) => ReadTuple (Tuple a (Tuple b c))(ReadForeign a, ReadForeign b) => ReadTuple (Tuple a b)
#WriteForeign Source
class WriteForeign a whereMembers
Instances
WriteForeign ForeignWriteForeign StringWriteForeign NonEmptyStringWriteForeign IntWriteForeign CharWriteForeign NumberWriteForeign BigIntWriteForeign Boolean(WriteForeign a) => WriteForeign (Array a)(WriteForeign a) => WriteForeign (Maybe a)(WriteForeign a) => WriteForeign (Nullable a)(WriteForeign a, WriteForeign b) => WriteForeign (Either a b)(WriteForeign a) => WriteForeign (Object a)(WriteForeign a, WriteForeign (Tuple b c)) => WriteForeign (Tuple a (Tuple b c))(WriteForeign a, WriteForeign b) => WriteForeign (Tuple a b)(RowToList row rl, WriteForeignFields rl row () to) => WriteForeign (Record row)(RowToList row rl, WriteForeignVariant rl row) => WriteForeign (Variant row)(WriteForeign a) => WriteForeign (NonEmptyArray a)(WriteForeign a) => WriteForeign (Map String a)(WriteForeign a) => WriteForeign (Map Int a)(WriteForeign a) => WriteForeign (Map BigInt a)(Newtype nt key, WriteForeign (Map key value)) => WriteForeign (Map nt value)(WriteForeign a) => WriteForeign (Set a)WriteForeign JSDateWriteForeign DateTimeWriteForeign InstantWriteForeign MillisecondsWriteForeign SecondsWriteForeign MinutesWriteForeign HoursWriteForeign Days(WriteForeign a) => WriteForeign (Tree a)
#WriteForeignFields Source
class WriteForeignFields :: RowList Type -> Row Type -> Row Type -> Row Type -> Constraintclass WriteForeignFields (rl :: RowList Type) row (from :: Row Type) (to :: Row Type) | rl -> row from to where
Members
writeImplFields :: forall g. g rl -> Record row -> Builder (Record from) (Record to)
Instances
(IsSymbol name, WriteForeign ty, WriteForeignFields tail row from from', Cons name ty whatever row, Lacks name from', Cons name Foreign from' to) => WriteForeignFields (Cons name ty tail) row from toWriteForeignFields Nil row () ()
#WriteForeignVariant Source
class WriteForeignVariant :: RowList Type -> Row Type -> Constraintclass WriteForeignVariant (rl :: RowList Type) (row :: Row Type) | rl -> row where
Members
writeVariantImpl :: forall g. g rl -> Variant row -> Foreign
Instances
WriteForeignVariant Nil ()(IsSymbol name, WriteForeign ty, Cons name ty subRow row, WriteForeignVariant tail subRow) => WriteForeignVariant (Cons name ty tail) row
#writePrettyJSON Source
writePrettyJSON :: forall a. WriteForeign a => Int -> a -> String#writeJSON Source
writeJSON :: forall a. WriteForeign a => a -> StringWrite a JSON string from a type a.
#unsafeStringify Source
unsafeStringify :: forall a. a -> String#read_ Source
read_ :: forall @a. ReadForeign a => Foreign -> Maybe aRead a Foreign value to a type, as a Maybe of type
#readJSON_ Source
readJSON_ :: forall @a. ReadForeign a => String -> Maybe aRead a JSON string to a type a while returning Nothing if the parsing
failed.
#readJSON' Source
readJSON' :: forall @a. ReadForeign a => String -> F aRead a JSON string to a type a using F a. Useful with record types.
#readJSON Source
readJSON :: forall @a. ReadForeign a => String -> E aRead a JSON string to a type a while returning a MultipleErrors if the
parsing failed.
Re-exports from Yoga.Om
#ParOm Source
#Om Source
newtype Om :: Type -> Row Type -> Type -> Typenewtype Om ctx err a
"dependency injection" via ReaderT which tracks a context, and
checked exceptions and early return with ExceptV.
Constructors
Instances
Newtype (Om ctx err a) _Functor (Om ctx err)Applicative (Om ctx err)Apply (Om ctx err)Bind (Om ctx err)Monad (Om ctx err)MonadEffect (Om ctx err)MonadAff (Om ctx err)MonadAsk ctx (Om ctx err)MonadReader ctx (Om ctx err)MonadThrow (Variant (Exception err)) (Om ctx err)MonadError (Variant (Exception err)) (Om ctx err)MonadRec (Om ctx err)(Semigroup a) => Semigroup (Om ctx err a)Alt (Om ctx err)Plus (Om ctx err)(RowToList ctx ctxRL, RowToList err errRL, Union ctx _c ctxRow, Keys ctx, Union err _e errRow) => Mapping (ExpandAndRun ctxRow errRow) (Om (Record ctx) err a) (Aff a)(IsSymbol sym, Cons sym a rb rc, Lacks sym rb, RowToList cSmall _cRL, RowToList eSmall _eRL, Union cSmall _c ctxRow, Keys cSmall, Union eSmall _e err) => FoldingWithIndex (SequenceOm ctxRow err) (Proxy sym) (Om (Record ctxRow) err (Builder (Record ra) (Record rb))) (Om (Record cSmall) eSmall a) (Om (Record ctxRow) err (Builder (Record ra) (Record rc)))(RowToList ctx ctxRL, RowToList err errRL) => Mapping CloseOmRows (Om (Record ctx) err a) (Om (Record ctx) err a)Parallel (ParOm ctx err) (Om ctx err)
#widenCtx Source
widenCtx :: forall err additionalCtx ctx widerCtx. Union additionalCtx ctx widerCtx => Nub widerCtx widerCtx => Record additionalCtx -> (Om (Record widerCtx) err) ~> (Om (Record ctx) err)Manually add some fields to the context of a computation.
This function is useful when already inside a do block of an Om
and you want to call a function that requires some ctx that you obtained
within this do block. For example:
do
moreCtx <- getSomeData :: Om {} _
getMoreData :: Om { moreCtx :: _ } _ # widenCtx { moreCtx }
#unliftAffFn Source
unliftAffFn :: forall ctx arg errors a. (arg -> Om ctx () a) -> Om ctx errors (arg -> Aff a)Useful when constructing a callback of type Aff or Effect within the
context of an Om computation
uploadDOM ∷ (SerialisedDOM -> Aff _) <- do
Om.unliftAffFn $ uploadDOMSnapshot
#unliftAff Source
unliftAff :: forall ctx err otherErrors a. Om ctx err a -> Om ctx otherErrors (Aff (Either (Variant (Exception err)) a))Useful when constructing a parameterless callback of type Aff or
Effect within the context of an Om computation
recordAndUploadDOM ∷ Aff _ <- do
Om.unliftAff $ serialiseDOM >>= uploadDOMSnapshot
#throwLeftAsM Source
throwLeftAsM :: forall err m left right. MonadThrow err m => (left -> m err) -> Either left right -> m rightTurns a Left a into an exception which reduces nesting
#throwLeftAs Source
throwLeftAs :: forall err m left right. MonadThrow err m => (left -> err) -> Either left right -> m rightTurns a Left a into an exception which reduces nesting
#throw Source
throw :: forall m err errors a. SingletonVariantRecord err errors => MonadThrow (OneOfTheseErrors errors) m => Record err -> m a#sequenceOmRecord Source
sequenceOmRecord :: forall ctxRow err rin closed rout. HMap CloseOmRows (Record rin) (Record closed) => HFoldlWithIndex (SequenceOm ctxRow err) (Om (Record ctxRow) err (Builder (Record ()) (Record ()))) (Record closed) (Om (Record ctxRow) err (Builder (Record ()) (Record rout))) => Record rin -> Om (Record ctxRow) err (Record rout)#runOmsInOm Source
runOmsInOm :: forall ctxRow r rl err_ err outerErr rin closed rout. RowToList (exception :: Error -> Aff Unit | r) rl => VariantMatchCases rl err_ (Aff Unit) => Union err_ () (exception :: Error | err) => HMap CloseOmRows (Record rin) (Record closed) => HMap (ExpandAndRun ctxRow err) (Record closed) (Record rout) => { exception :: Error -> Aff Unit | r } -> Record rin -> Om (Record ctxRow) outerErr (Record rout)#runOms Source
runOms :: forall ctxRow r rl err_ err rin closed rout. RowToList (exception :: Error -> Aff Unit | r) rl => VariantMatchCases rl err_ (Aff Unit) => Union err_ () (exception :: Error | err) => HMap CloseOmRows (Record rin) (Record closed) => HMap (ExpandAndRun ctxRow err) (Record closed) (Record rout) => Record ctxRow -> { exception :: Error -> Aff Unit | r } -> Record rin -> Record rout#runOmRecord Source
runOmRecord :: forall ctxRow r rl err_ err rin closed rout. RowToList (exception :: Error -> Aff (Record rout) | r) rl => VariantMatchCases rl err_ (Aff (Record rout)) => Union err_ () (exception :: Error | err) => HMap CloseOmRows (Record rin) (Record closed) => HFoldlWithIndex (SequenceOm ctxRow err) (Om (Record ctxRow) err (Builder (Record ()) (Record ()))) (Record closed) (Om (Record ctxRow) err (Builder (Record ()) (Record rout))) => Record ctxRow -> { exception :: Error -> Aff (Record rout) | r } -> Record rin -> Aff (Record rout)Run a record of Om actions and return the results as a record.
Each field can be an Om with open context/error rows — they are
automatically expanded to the target context and error types.
runOmRecord ctx handlers
{ hello: Om.query @Queries @"hello" <#> _.hello
, users: Om.query @Queries @"users { name age }" <#> _.users
}
#runOm Source
runOm :: forall ctx r rl err_ err a. RowToList (exception :: Error -> Aff a | r) rl => VariantMatchCases rl err_ (Aff a) => Union err_ () (Exception err) => ctx -> { exception :: Error -> Aff a | r } -> Om ctx err a -> Aff aInvoke this function in the end and handle all possible errors, e.g.
runOm { token: "123" } { someError: \e -> handleTheError e } someApp
#noteM Source
noteM :: forall err m a. MonadThrow err m => m err -> Maybe a -> m a#note Source
note :: forall m err errors a. SingletonVariantRecord err errors => MonadThrow (OneOfTheseErrors errors) m => Record err -> Maybe a -> m aTurns a Nothing into an exception which reduces nesting and encourages
tracking what actually went wrong
e.g.
do
let maybeCached = Object.lookup key cache :: Maybe a
cached :: a <- maybeCached # Om.note (unexpectedCacheMiss key)
#mapError Source
mapError :: forall @from @to tyIn tyOut ctx errIn errMid errOut a. IsSymbol from => IsSymbol to => Cons from tyIn (exception :: Error | errMid) (exception :: Error | errIn) => Cons to tyOut (exception :: Error | errMid) (exception :: Error | errOut) => (tyIn -> tyOut) -> Om ctx errIn a -> Om ctx errOut a#inParallel Source
inParallel :: forall ctx e a. Array (Om ctx e a) -> Om ctx e (Array a)Run multiple Oms in parallel, and collect all results
To only take the fastest result, use race
#handleErrors Source
handleErrors :: forall ctx errIn errOut a (handlersRL :: RowList Type) (handlers :: Row Type) (handled :: Row Type). RowToList handlers handlersRL => VariantMatchCases handlersRL handled (Om ctx errOut a) => Union handled (exception :: Error | errOut) (exception :: Error | errIn) => Record handlers -> Om ctx errIn a -> Om ctx errOut a#expandCtx Source
expandCtx :: forall lt more gt err. Union lt more gt => Keys lt => (Om (Record lt) err) ~> (Om (Record gt) err)When you have a function that requires a closed subset of the context of
the one you're operating in, expandCtx allows to call this function in a
do block, e.g.:
let
otherComp :: Om { a :: A } _ _
otherComp = ...
myComp :: Om { a :: A, b :: B } _ _
myComp = do
...
otherComp # expandCtx
#error Source
error :: forall err errors. SingletonVariantRecord err errors => Record err -> OneOfTheseErrors errors- Modules
- Script.
Prelude
The
Functorinstance allows functions to transform the contents of aRightwith the<$>operator:Leftvalues are untouched: