Module

Snail

Package
purescript-snail
Repository
thimoteus/purescript-snail

#crawl Source

crawl :: forall a e. Snail e a -> Script e Unit

Runs a Snail computation

#echo Source

echo :: forall e. String -> Snail e String

Print a string to standard output

#err Source

err :: forall e. String -> Snail e String

Print a string to standard error

#(|>) Source

Operator alias for Control.Bind.bind (left-associative / precedence 4)

#sleep Source

sleep :: forall e. Int -> Snail e Unit

Pause the script for a given number of seconds

#loop Source

loop :: forall e b a. Int -> Snail e a -> Snail e b

Given a number of seconds n and a computation c, loop c every n seconds

#run Source

run :: forall e. String -> Array String -> Snail e String

Run a command with an array of arguments, getting the output as a UTF8 encoded string.

#command Source

command :: forall e. String -> Array String -> Snail e Unit

Run a command, disregarding the output.

#fork Source

fork :: forall e. String -> Array String -> Snail e Unit

Send a process into the background.

#ls Source

ls :: forall e. Folder -> Snail e { files :: Array String, folders :: Array String }

Given a folder, partition its contents into files and subfolders.

#appendFile Source

appendFile :: forall e. String -> File -> Snail e Unit

Append a given string to the end of a given file.

#(>>) Source

Operator alias for Snail.appendFile (left-associative / precedence 4)

#writeFile Source

writeFile :: forall e. String -> File -> Snail e Unit

Create or overwrite the given file with the given UTF8 string.

#(+>) Source

Operator alias for Snail.writeFile (left-associative / precedence 4)

#cat Source

cat :: forall e. File -> Snail e String

Get the contents of the given file.

#prependFile Source

prependFile :: forall e. String -> File -> Snail e Unit

Add a given string to the beginning of the given file.

#andandand Source

andandand :: forall e b a. Snail e a -> Snail e b -> Snail e b

Run the first computation, and stop if that fails. Otherwise run the second.

#(&&&) Source

Operator alias for Snail.andandand (right-associative / precedence 3)

#ororor Source

ororor :: forall e b a. Snail e a -> Snail e b -> Snail e Unit

Run the first computation, and stop if it succeeds.

#(|||) Source

Operator alias for Snail.ororor (right-associative / precedence 2)

#exists Source

exists :: forall e address. Address address => address -> Snail e Boolean

Check if a file or folder exists

#mIf Source

mIf :: forall a m. Bind m => m Boolean -> (Unit -> m a) -> (Unit -> m a) -> m a

Given a monadic boolean, run either the first thunked computation or the second.

#(~~>) Source

Operator alias for Snail.mIf (right-associative / precedence 1)

#when Source

when :: forall a m. Monad m => m Boolean -> (Unit -> m a) -> m Unit

Run a given computation when a monadic boolean is true.

#(~?>) Source

Operator alias for Snail.when (right-associative / precedence 1)

#touch Source

touch :: forall e. File -> Snail e Unit

Create a file with no contents.

#rm Source

rm :: forall e. File -> Snail e Unit

Delete a given file.

#rmdir Source

rmdir :: forall e. Folder -> Snail e Unit

Delete a given folder.

#mkdir Source

mkdir :: forall e. Folder -> Snail e Unit

Create a given directory.

#args Source

args :: forall e. Snail e (Array String)

Get all the arguments to the script.

#params Source

params :: forall e. Snail e (Array String)

Get the arguments to the script, minus the first two, the first of which is always "node", the second is the name of the file being executed.

#input Source

input :: forall e. Snail e String

Get the first non-mandatory argument, which must have necessarily been provided.

#exit Source

exit :: forall e a. Int -> Snail e a

Exit the script with the given exit code.

#printEnv Source

printEnv :: forall e. Snail e (StrMap String)

Get the current environment.

#setVar Source

setVar :: forall e. String -> String -> Snail e Unit

Set the given environment variable to the given string value.

#getVar Source

getVar :: forall e. String -> Snail e String

Get the given environment variable's value.

#exitWith Source

exitWith :: forall e a. Int -> String -> Snail e a

Exit the script with the given exit code, printing the given message to standard output if the exit code is 0, and standard error otherwise.

#(!?) Source

Operator alias for Snail.exitWith (non-associative / precedence 5)

#fromJust Source

fromJust :: forall e a. String -> Maybe a -> Snail e a

Extract the value of a Just, failing with a given error message otherwise.

#fromMaybe Source

fromMaybe :: forall e a. a -> Maybe a -> Snail e a

Extract the value of a Maybe with a default if Nothing is found.

#fromEither Source

fromEither :: forall b a e. Show a => Either a b -> Snail e b

Extract the Right value of an Either, otherwise turn the Left into an error.

Re-exports from Snail.OS

#uptime Source

uptime :: forall e. Snail e Seconds

#totalmem Source

totalmem :: forall e. Snail e Number

#tmp Source

tmp :: forall e. Snail e Folder

#release Source

release :: forall e. Snail e String

#platform Source

platform :: forall e. Snail e Platform

#ostype Source

ostype :: forall e. Snail e String

#networkInterfaces Source

#loadavg Source

loadavg :: forall e. Snail e { fifteen :: Number, five :: Number, one :: Number }

#hostname Source

hostname :: forall e. Snail e String

#home Source

home :: forall e. Snail e Folder

#freemem Source

freemem :: forall e. Snail e Number

#endianness Source

endianness :: forall e. Snail e Endianness

#cpus Source

cpus :: forall e. Snail e (Array CPU)

#arch Source

arch :: forall e. Snail e Arch

Re-exports from Snail.Path

#pathpend Source

#(</>) Source

Operator alias for Snail.Path.pathpend (left-associative / precedence 6)

Re-exports from Snail.Types

#SnailEff Source

type SnailEff e = (buffer :: BUFFER, console :: CONSOLE, cp :: CHILD_PROCESS, err :: EXCEPTION, fs :: FS, os :: OS, process :: PROCESS | e)

#Snail Source

type Snail e = Aff (SnailEff e)

#Script Source

type Script e = Eff (SnailEff e)

#Folder Source

type Folder = TagString (folder :: FOLDER)

#File Source

type File = TagString (file :: FILE)

#FOLDER Source

data FOLDER

#FILE Source

data FILE

#Address Source

class Address a  where

Members

Instances

#runFile Source