Safe Haskell | None |
---|---|
Language | Haskell2010 |
promoted io functions
Synopsis
- data ReadFile p
- data ReadFileBinary p
- data FileExists p
- data ReadDir p
- data DirExists p
- data AppendFile (s :: Symbol) p
- data WriteFile (s :: Symbol) p
- data WriteFile' (s :: Symbol) p
- data Stdout p
- data Stderr p
- data Stdin
- type ReadIO (t :: Type) = ReadIO' t "Enter value"
- type ReadIO' (t :: Type) s = Stdout (s <> ":") >> (Stdin >> ReadP t Id)
- data ReadEnv p
- data ReadEnvAll
- data TimeUtc
- data TimeZt
file handling
similar to readFile
>>>
pz @(ReadFile "LICENSE" >> 'Just Id >> Len > 0) ()
Val True
>>>
pz @(FileExists "xyzzy") ()
Val False
data ReadFileBinary p Source #
similar to readFile
Instances
(PP p x ~ String, P p x) => P (ReadFileBinary p :: Type) x Source # | |
Defined in Predicate.Data.IO type PP (ReadFileBinary p) x Source # eval :: MonadEval m => proxy (ReadFileBinary p) -> POpts -> x -> m (TT (PP (ReadFileBinary p) x)) Source # | |
Show (ReadFileBinary p) Source # | |
Defined in Predicate.Data.IO showsPrec :: Int -> ReadFileBinary p -> ShowS # show :: ReadFileBinary p -> String # showList :: [ReadFileBinary p] -> ShowS # | |
type PP (ReadFileBinary p :: Type) x Source # | |
Defined in Predicate.Data.IO |
data FileExists p Source #
similar to doesFileExist
Instances
P (FileExistsT p) x => P (FileExists p :: Type) x Source # | |
Defined in Predicate.Data.IO type PP (FileExists p) x Source # eval :: MonadEval m => proxy (FileExists p) -> POpts -> x -> m (TT (PP (FileExists p) x)) Source # | |
Show (FileExists p) Source # | |
Defined in Predicate.Data.IO showsPrec :: Int -> FileExists p -> ShowS # show :: FileExists p -> String # showList :: [FileExists p] -> ShowS # | |
type PP (FileExists p :: Type) x Source # | |
Defined in Predicate.Data.IO |
similar to listDirectory
similar to doesDirectoryExist
>>>
pz @(DirExists ".") ()
Val True
>>>
pz @(DirExists "xxy") ()
Val False
data AppendFile (s :: Symbol) p Source #
append to a file
Instances
P (AppendFileT s p) x => P (AppendFile s p :: Type) x Source # | |
Defined in Predicate.Data.IO type PP (AppendFile s p) x Source # eval :: MonadEval m => proxy (AppendFile s p) -> POpts -> x -> m (TT (PP (AppendFile s p) x)) Source # | |
Show (AppendFile s p) Source # | |
Defined in Predicate.Data.IO showsPrec :: Int -> AppendFile s p -> ShowS # show :: AppendFile s p -> String # showList :: [AppendFile s p] -> ShowS # | |
type PP (AppendFile s p :: Type) x Source # | |
Defined in Predicate.Data.IO |
data WriteFile (s :: Symbol) p Source #
write to file, without overwriting
data WriteFile' (s :: Symbol) p Source #
write to file, overwriting if needed
Instances
P (WriteFileT' s p) x => P (WriteFile' s p :: Type) x Source # | |
Defined in Predicate.Data.IO type PP (WriteFile' s p) x Source # eval :: MonadEval m => proxy (WriteFile' s p) -> POpts -> x -> m (TT (PP (WriteFile' s p) x)) Source # | |
Show (WriteFile' s p) Source # | |
Defined in Predicate.Data.IO showsPrec :: Int -> WriteFile' s p -> ShowS # show :: WriteFile' s p -> String # showList :: [WriteFile' s p] -> ShowS # | |
type PP (WriteFile' s p :: Type) x Source # | |
Defined in Predicate.Data.IO |
screen
write a string value to stdout
write a string value to stderr
read a value from stdin
type ReadIO (t :: Type) = ReadIO' t "Enter value" Source #
read in a value of a given type from stdin with a prompt: similar to readIO
type ReadIO' (t :: Type) s = Stdout (s <> ":") >> (Stdin >> ReadP t Id) Source #
similar to ReadIO
but allow the user to specify the prompt string s
environment
read an environment variable: similar to getEnv
>>>
pz @(ReadEnv "PATH" >> Just' >> Not Null) ()
Val True
>>>
pl @(ReadEnv "xyzzy") ()
Present Nothing (ReadEnv[xyzzy] does not exist) Val Nothing
data ReadEnvAll Source #
read all the environment variables as key value pairs: similar to getEnvironment
Instances
Show ReadEnvAll Source # | |
Defined in Predicate.Data.IO showsPrec :: Int -> ReadEnvAll -> ShowS # show :: ReadEnvAll -> String # showList :: [ReadEnvAll] -> ShowS # | |
P ReadEnvAll a Source # | |
Defined in Predicate.Data.IO type PP ReadEnvAll a Source # eval :: MonadEval m => proxy ReadEnvAll -> POpts -> a -> m (TT (PP ReadEnvAll a)) Source # | |
type PP ReadEnvAll a Source # | |
Defined in Predicate.Data.IO |
date time
get the current time using UTCTime