-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Prelude based on protolude for GHC 8 and beyond. -- -- A Prelude relpacement for GHC 8 with a focus on building applications -- with Lenses, Machines, and Applicatives. @package liblawless @version 0.18.0 module Tree module Textual module Text module Set -- | A set of values a. data Set a :: * -> * sing :: Getter a (Set a) module Parser -- | Network type library module Networking module Map -- | A Map from keys k to values a. data Map k a :: * -> * -> * -- | O(1). A map with a single element. -- --
--   singleton 1 'a'        == fromList [(1, 'a')]
--   size (singleton 1 'a') == 1
--   
singleton :: k -> a -> Map k a module Lawless module Machine (⇝) :: Monad m => MachineT m k b -> ProcessT m b c -> MachineT m k c infixl 9 ⇝ (⇜) :: Monad m => ProcessT m b c -> MachineT m k b -> MachineT m k c infixr 9 ⇜ module Text.IO readFile :: (MonadIO m) => AbsRelFile -> m Text writeFile :: (MonadIO m) => AbsRelFile -> Text -> m () appendFile :: (MonadIO m) => AbsRelFile -> Text -> m () hGetLine :: (MonadIO m) => Handle -> m Text hPutStr :: (MonadIO m) => Handle -> Text -> m () hPutStrLn :: (MonadIO m) => Handle -> Text -> m () getLine :: (MonadIO m) => m Text putStr :: (MonadIO m) => Text -> m () putStrLn :: (MonadIO m) => Text -> m () module Generics module Time data Time -- | The class of types which can be parsed given a UNIX-style time format -- string. class ParseTime t -- | Builds a time value from a parsed input string. If the input does not -- include all the information needed to construct a complete value, any -- missing parts should be taken from 1970-01-01 00:00:00 +0000 (which -- was a Thursday). In the absence of %C or %Y, century -- is 1969 - 2068. buildTime :: ParseTime t => TimeLocale -> [(Char, String)] -> Maybe t class FormatTime t formatCharacter :: FormatTime t => Char -> Maybe (TimeLocale -> Maybe NumericPadOption -> t -> String) _Time :: Iso' Time UTCTime day :: Lens' Time Day time :: Lens' Time DiffTime now :: IO Time instance Data.Binary.Class.Binary Time.Time instance Data.Textual.Printable Time.Time instance GHC.Generics.Generic Time.Time instance Data.Time.Format.FormatTime Time.Time instance Data.Time.Format.Parse.ParseTime Time.Time instance GHC.Classes.Ord Time.Time instance GHC.Classes.Eq Time.Time instance GHC.Show.Show Time.Time module Exception module ByteString module Boomerang type TextsBoomerang a b = Boomerang TextsError [Text] a b (∘) :: forall (b :: k) (c :: k) (a :: k) (cat :: k -> k -> *). Category cat => cat b c -> cat a b -> cat a c infix 9 ∘ module Arbitrary instance Test.QuickCheck.Arbitrary.Arbitrary Data.Text.Internal.Text instance Test.QuickCheck.Arbitrary.Arbitrary Data.Time.Calendar.Days.Day instance Test.QuickCheck.Arbitrary.Arbitrary Data.Time.Clock.Scale.DiffTime instance Test.QuickCheck.Arbitrary.Arbitrary Data.Time.Clock.UTC.UTCTime instance Test.QuickCheck.Arbitrary.Arbitrary Time.Time module Aeson lawlessJSONOptions :: Options lawlessToJSONEncoding :: forall a. (GToEncoding (Rep a), Generic a) => a -> Encoding lawlessParseJSON :: forall a. (GFromJSON (Rep a), Generic a) => Value -> Parser a module Path -- | Add an extension, even if there is already one there. E.g. -- addExtension "foo.txt" "bat" -> "foo.txt.bat". -- --
--   > Path.addExtension (relFile "file.txt") "bib" == Posix.relFile "file.txt.bib"
--   > Path.addExtension (relFile "file.") ".bib" == Posix.relFile "file..bib"
--   > Path.addExtension (relFile "file") ".bib" == Posix.relFile "file.bib"
--   > Path.addExtension Path.emptyFile "bib" == Posix.relFile ".bib"
--   > Path.addExtension Path.emptyFile ".bib" == Posix.relFile ".bib"
--   > Path.takeFileName (Path.addExtension Path.emptyFile "ext") == Posix.relFile ".ext"
--   
addExtension :: FilePath os ar -> String -> FilePath os ar -- | Join an (absolute or relative) directory path with a relative (file or -- directory) path to form a new path. combine :: DirPath os ar -> RelPath os fd -> Path os ar fd currentDir :: RelDir -- | Remove last extension, and the "." preceding it. -- --
--   > Path.dropExtension x == fst (Path.splitExtension x)
--   
dropExtension :: FilePath os ar -> FilePath os ar -- | Drop all extensions -- --
--   > not $ Path.hasAnExtension (Path.dropExtensions x)
--   
dropExtensions :: FilePath os ar -> FilePath os ar -- | Synonym for takeDirectory dropFileName :: FilePath os ar -> DirPath os ar emptyFile :: RelFile mapFileName :: (String -> String) -> FilePath os ar -> FilePath os ar mapFileNameF :: Functor f => (String -> f String) -> FilePath os ar -> f (FilePath os ar) replaceBaseName :: FilePath os ar -> String -> FilePath os ar replaceDirectory :: FilePath os ar1 -> DirPath os ar2 -> FilePath os ar2 -- | Set the extension of a file, overwriting one if already present. -- --
--   > Path.replaceExtension (relFile "file.txt") ".bob" == Posix.relFile "file.bob"
--   > Path.replaceExtension (relFile "file.txt") "bob" == Posix.relFile "file.bob"
--   > Path.replaceExtension (relFile "file") ".bob" == Posix.relFile "file.bob"
--   > Path.replaceExtension (relFile "file.txt") "" == Posix.relFile "file"
--   > Path.replaceExtension (relFile "file.fred.bob") "txt" == Posix.relFile "file.fred.txt"
--   
replaceExtension :: FilePath os ar -> String -> FilePath os ar replaceFileName :: FilePath os ar -> String -> FilePath os ar rootDir :: AbsDir splitDirName :: DirPath os ar -> Maybe (DirPath os ar, RelDir os) -- | Split on the extension. addExtension is the inverse. -- --
--   > uncurry (<.>) (Path.splitExtension x) == x
--   > uncurry Path.addExtension (Path.splitExtension x) == x
--   > Path.splitExtension (relFile "file.txt") == (Posix.relFile "file",".txt")
--   > Path.splitExtension (relFile ".bashrc") == (Posix.emptyFile, ".bashrc")
--   > Path.splitExtension (relFile "file") == (Posix.relFile "file","")
--   > Path.splitExtension (relFile "file/file.txt") == (Posix.relFile "file/file",".txt")
--   > Path.splitExtension (relFile "file.txt/boris") == (Posix.relFile "file.txt/boris","")
--   > Path.splitExtension (relFile "file.txt/boris.ext") == (Posix.relFile "file.txt/boris",".ext")
--   > Path.splitExtension (relFile "file/path.txt.bob.fred") == (Posix.relFile "file/path.txt.bob",".fred")
--   
splitExtension :: FilePath os ar -> (FilePath os ar, String) -- | Split on all extensions -- --
--   > Path.splitExtensions (relFile "file.tar.gz") == (Posix.relFile "file",".tar.gz")
--   
splitExtensions :: FilePath os ar -> (FilePath os ar, String) splitFileName :: FilePath os ar -> (DirPath os ar, RelFile os) -- | Deconstructs a path into its components. -- --
--   > Path.splitPath (Posix.absDir "/tmp/someDir/mydir.dir") == (True, map relDir ["tmp","someDir","mydir.dir"], Nothing)
--   > Path.splitPath (Posix.absFile "/tmp/someDir/myfile.txt") == (True, map relDir ["tmp","someDir"], Just $ relFile "myfile.txt")
--   
splitPath :: (AbsRel ar, FileOrDir fd) => Path os ar fd -> (Bool, [RelDir os], Maybe (RelFile os)) -- | Get the basename of a file -- --
--   > Path.takeBaseName (absFile "/tmp/somedir/myfile.txt") == Posix.relFile "myfile"
--   > Path.takeBaseName (relFile "./myfile.txt") == Posix.relFile "myfile"
--   > Path.takeBaseName (relFile "myfile.txt") == Posix.relFile "myfile"
--   
takeBaseName :: FilePath os ar -> RelFile os takeDirName :: DirPath os ar -> Maybe (RelDir os) takeDirectory :: FilePath os ar -> DirPath os ar -- | Get the extension of a file, returns "" for no extension, -- .ext otherwise. -- --
--   > Path.takeExtension x == snd (Path.splitExtension x)
--   > Path.takeExtension (Path.addExtension x "ext") == ".ext"
--   > Path.takeExtension (Path.replaceExtension x "ext") == ".ext"
--   
takeExtension :: FilePath os ar -> String -- | Get all extensions -- --
--   > Path.takeExtensions (Posix.relFile "file.tar.gz") == ".tar.gz"
--   
takeExtensions :: FilePath os ar -> String -- | Get the filename component of a file path (ie stripping all parent -- dirs) -- --
--   > Path.takeFileName (absFile "/tmp/somedir/myfile.txt") == Posix.relFile "myfile.txt"
--   > Path.takeFileName (relFile "./myfile.txt") == Posix.relFile "myfile.txt"
--   > Path.takeFileName (relFile "myfile.txt") == Posix.relFile "myfile.txt"
--   
takeFileName :: FilePath os ar -> RelFile os takeSuperDirectory :: DirPath os ar -> Maybe (DirPath os ar) toString :: (AbsRel ar, FileDir fd) => Path ar fd -> String equalFilePath :: String -> String -> Bool -- | Constructs a RelPath from a list of components. It is an -- unchecked error if the path components contain path separators. It is -- an unchecked error if a RelFile path is empty. -- --
--   > Path.joinPath ["tmp","someDir","dir"] == Posix.relDir "tmp/someDir/dir"
--   > Path.joinPath ["tmp","someDir","file.txt"] == Posix.relFile "tmp/someDir/file.txt"
--   
joinPath :: FileDir fd => [String] -> RelPath os fd -- | Currently just transforms: -- --
--   > Path.normalise (absFile "/tmp/fred/./jim/./file") == Posix.absFile "/tmp/fred/jim/file"
--   
normalise :: System os => Path os ar fd -> Path os ar fd -- | Deconstructs a path into its components. -- --
--   > Path.splitPath (Posix.absDir "/tmp/someDir/mydir.dir") == (True, map relDir ["tmp","someDir","mydir.dir"], Nothing)
--   > Path.splitPath (Posix.absFile "/tmp/someDir/myfile.txt") == (True, map relDir ["tmp","someDir"], Just $ relFile "myfile.txt")
--   
splitPath :: (AbsRel ar, FileOrDir fd) => Path os ar fd -> (Bool, [RelDir os], Maybe (RelFile os)) -- | This function can be used to construct a relative path by removing the -- supplied AbsDir from the front. It is a runtime error if -- the supplied AbsPath doesn't start with the AbsDir. -- --
--   > Path.makeRelative (absDir "/tmp/somedir") (absFile "/tmp/somedir/anotherdir/file.txt") == Posix.relFile "anotherdir/file.txt"
--   > Path.makeRelative (absDir "/tmp/somedir") (absDir "/tmp/somedir/anotherdir/dir") == Posix.relDir "anotherdir/dir"
--   > Path.makeRelative (absDir "c:\\tmp\\somedir") (absFile "C:\\Tmp\\SomeDir\\AnotherDir\\File.txt") == Windows.relFile "AnotherDir\\File.txt"
--   > Path.makeRelative (absDir "c:\\tmp\\somedir") (absDir "c:\\tmp\\somedir\\anotherdir\\dir") == Windows.relDir "anotherdir\\dir"
--   > Path.makeRelative (absDir "c:tmp\\somedir") (absDir "c:tmp\\somedir\\anotherdir\\dir") == Windows.relDir "anotherdir\\dir"
--   
makeRelative :: (System os, FileDir fd) => AbsDir os -> AbsPath os fd -> RelPath os fd makeRelativeMaybe :: (System os, FileDir fd) => AbsDir os -> AbsPath os fd -> Maybe (RelPath os fd) -- | Joins an absolute directory with a relative path to construct a new -- absolute path. -- --
--   > Path.makeAbsolute (absDir "/tmp") (relFile "file.txt")      == Posix.absFile "/tmp/file.txt"
--   > Path.makeAbsolute (absDir "/tmp") (relFile "adir/file.txt") == Posix.absFile "/tmp/adir/file.txt"
--   > Path.makeAbsolute (absDir "/tmp") (relDir  "adir/dir")      == Posix.absDir "/tmp/adir/dir"
--   
makeAbsolute :: System os => AbsDir os -> RelPath os fd -> AbsPath os fd -- | Converts a relative path into an absolute one by prepending the -- current working directory. makeAbsoluteFromCwd :: System os => RelPath os fd -> IO (AbsPath os fd) dynamicMakeAbsolute :: System os => AbsDir os -> AbsRelPath os fd -> AbsPath os fd dynamicMakeAbsoluteFromCwd :: System os => AbsRelPath os fd -> IO (AbsPath os fd) -- | As for makeAbsolute, but for use when the path may already be -- absolute (in which case it is left unchanged). You should avoid the -- use of genericMakeAbsolute-type functions, because then you -- avoid to absolutize a path that was already absolutized. -- --
--   > Path.genericMakeAbsolute (absDir "/tmp") (relFile "file.txt")       == Posix.absFile "/tmp/file.txt"
--   > Path.genericMakeAbsolute (absDir "/tmp") (relFile "adir/file.txt")  == Posix.absFile "/tmp/adir/file.txt"
--   > Path.genericMakeAbsolute (absDir "/tmp") (absFile "/adir/file.txt") == Posix.absFile "/adir/file.txt"
--   
genericMakeAbsolute :: (System os, AbsRel ar) => AbsDir os -> Path os ar fd -> AbsPath os fd -- | As for makeAbsoluteFromCwd, but for use when the path may -- already be absolute (in which case it is left unchanged). genericMakeAbsoluteFromCwd :: (System os, AbsRel ar) => Path os ar fd -> IO (AbsPath os fd) -- | Map over the components of the path. -- --
--   > Path.pathMap (map toLower) (absDir "/tmp/Reports/SpreadSheets") == Posix.absDir "/tmp/reports/spreadsheets"
--   
pathMap :: FileDir fd => (String -> String) -> Path os ar fd -> Path os ar fd -- | Convert a file to a directory path. Obviously, the corresponding disk -- object won't change accordingly. The purpose of this function is to be -- an intermediate step when deriving a directory name from a file name. dirFromFile :: FilePath os ar -> DirPath os ar -- | Convert a directory to a file path. The function returns -- Nothing if the directory path is empty. The purpose of this -- function is to be an intermediate step when deriving a file name from -- a directory name. fileFromDir :: DirPath os ar -> Maybe (FilePath os ar) toFileDir :: FileDir fd => Path os ar fd -> FileDirPath os ar fromFileDir :: FileDir fd => FileDirPath os ar -> Maybe (Path os ar fd) fileFromFileDir :: FileDirPath os ar -> Maybe (FilePath os ar) dirFromFileDir :: FileDirPath os ar -> DirPath os ar -- | Test whether a Path ar fd is absolute. -- --
--   > Path.isAbsolute (Posix.absFile "/fred")
--   > Path.isAbsolute (Windows.absFile "\\fred")
--   > Path.isAbsolute (Windows.absFile "c:\\fred")
--   > Path.isAbsolute (Windows.absFile "c:fred")
--   
isAbsolute :: AbsRel ar => Path os ar fd -> Bool -- | Invariant - this should return True iff arg is of type Path -- Part.Rel _ -- --
--    isRelative = not . isAbsolute
--   > Path.isRelative (Posix.relFile "fred")
--   > Path.isRelative (Windows.relFile "fred")
--   
isRelative :: AbsRel ar => Path os ar fd -> Bool isAbsoluteString :: String -> Bool isRelativeString :: String -> Bool -- | Does the given filename have an extension? -- --
--   > null (Path.takeExtension x) == not (Path.hasAnExtension x)
--   
hasAnExtension :: FilePath os ar -> Bool -- | Does the given filename have the given extension? -- --
--   > Path.hasExtension ".hs" (Posix.relFile "MyCode.hs")
--   > Path.hasExtension ".hs" (Posix.relFile "MyCode.bak.hs")
--   > not $ Path.hasExtension ".hs" (Posix.relFile "MyCode.hs.bak")
--   
hasExtension :: String -> FilePath os ar -> Bool -- | Part.File extension character -- --
--   > Posix.extSeparator == '.'
--   
extSeparator :: Char -- | The character that is used to separate the entries in the $PATH -- environment variable. searchPathSeparator :: Char -- | Is the character an extension character? -- --
--   > Posix.isExtSeparator a == (a == Posix.extSeparator)
--   
isExtSeparator :: Char -> Bool -- | Is the character a file separator? -- --
--   > Posix.isSearchPathSeparator a == (a == Posix.searchPathSeparator)
--   
isSearchPathSeparator :: Char -> Bool -- | This is a more flexible variant of addExtension / -- <.> which can work with files or directories -- --
--   > Path.genericAddExtension (absDir "/") "x" == Posix.absDir "/.x"
--   > Path.genericAddExtension (absDir "/a") "x" == Posix.absDir "/a.x"
--   > Path.genericAddExtension Path.emptyFile "x" == Posix.relFile ".x"
--   > Path.genericAddExtension Path.emptyFile "" == Posix.emptyFile
--   
genericAddExtension :: FileDir fd => Path os ar fd -> String -> Path os ar fd genericDropExtension :: FileDir fd => Path os ar fd -> Path os ar fd genericDropExtensions :: FileDir fd => Path os ar fd -> Path os ar fd genericSplitExtension :: FileDir fd => Path os ar fd -> (Path os ar fd, String) genericSplitExtensions :: FileDir fd => Path os ar fd -> (Path os ar fd, String) genericTakeExtension :: FileDir fd => Path os ar fd -> String genericTakeExtensions :: FileDir fd => Path os ar fd -> String parse :: (AbsRel ar, FileDir fd) => String -> Either String (Path ar fd) toText :: (AbsRel ar, FileDir fd) => Path ar fd -> Text type AbsFile = AbsFile System type RelFile = RelFile System type AbsDir = AbsDir System type RelDir = RelDir System type AbsRelFile = AbsRelFile System type AbsRelDir = AbsRelDir System absFile :: (IsText t) => t -> AbsFile relFile :: (IsText t) => t -> RelFile absDir :: (IsText t) => t -> AbsDir relDir :: (IsText t) => t -> RelDir absRelFile :: (IsText t) => t -> AbsRelFile absRelDir :: (IsText t) => t -> AbsRelDir -- | Infix variant of combine. -- --
--   > Posix.toString (Posix.absDir "/tmp" </> Posix.relFile "file.txt") == "/tmp/file.txt"
--   > Posix.toString (Posix.absDir "/tmp" </> Posix.relDir "dir" </> Posix.relFile "file.txt") == "/tmp/dir/file.txt"
--   > Posix.toString (Posix.relDir "dir" </> Posix.relFile "file.txt") == "dir/file.txt"
--   > Windows.toString (Windows.absDir "\\tmp" </> Windows.relFile "file.txt") == "\\tmp\\file.txt"
--   > Windows.toString (Windows.absDir "c:\\tmp" </> Windows.relFile "file.txt") == "c:\\tmp\\file.txt"
--   > Windows.toString (Windows.absDir "c:tmp" </> Windows.relFile "file.txt") == "c:tmp\\file.txt"
--   > Windows.toString (Windows.absDir "c:\\" </> Windows.relDir "tmp" </> Windows.relFile "file.txt") == "c:\\tmp\\file.txt"
--   > Windows.toString (Windows.absDir "c:" </> Windows.relDir "tmp" </> Windows.relFile "file.txt") == "c:tmp\\file.txt"
--   > Windows.toString (Windows.relDir "dir" </> Windows.relFile "file.txt") == "dir\\file.txt"
--   
() :: DirPath os ar -> RelPath os fd -> Path os ar fd infixr 5 -- | Infix variant of addExtension. We only allow files (and not -- directories) to have extensions added by this function. This is -- because it's the vastly common case and an attempt to add one to a -- directory will - more often than not - represent an error. We don't -- however want to prevent the corresponding operation on directories, -- and so we provide a function that is more flexible: -- genericAddExtension. (<.>) :: FilePath os ar -> String -> FilePath os ar infixl 7 <.> (<++>) :: FilePath os ar -> String -> FilePath os ar infixl 7 <++> instance Data.Aeson.Types.Class.FromJSON System.Path.Posix.AbsFile instance Data.Aeson.Types.Class.ToJSON System.Path.Posix.AbsFile instance Data.Aeson.Types.Class.FromJSON System.Path.Posix.AbsDir instance Data.Aeson.Types.Class.ToJSON System.Path.Posix.AbsDir instance Data.Aeson.Types.Class.ToJSON System.Path.Posix.RelFile instance Data.Aeson.Types.Class.FromJSON System.Path.Posix.RelDir instance Data.Aeson.Types.Class.ToJSON System.Path.Posix.RelDir instance Data.Aeson.Types.Class.FromJSON System.Path.Posix.AbsRelDir instance Data.Aeson.Types.Class.ToJSON System.Path.Posix.AbsRelDir instance Data.Aeson.Types.Class.FromJSON System.Path.Posix.AbsRelFile instance Data.Aeson.Types.Class.ToJSON System.Path.Posix.AbsRelFile module IO putStr :: (MonadIO m, Printable p) => p -> m () putStrLn :: (MonadIO m, Printable p) => p -> m () -- | Build a Managed value managed :: (forall r. (a -> IO r) -> IO r) -> Managed a -- | A managed resource that you acquire using with data Managed a :: * -> * -- | You can embed a Managed action within any Monad that -- implements MonadManaged by using the using function -- -- All instances must obey the following two laws: -- --
--   using (return x) = return x
--   
--   using (m >>= f) = using m >>= \x -> using (f x)
--   
class MonadIO m => MonadManaged (m :: * -> *) using :: MonadManaged m => Managed a -> m a -- | Run a Managed computation, enforcing that no acquired resources -- leak runManaged :: Managed () -> IO () data TempFile tfPath :: Lens' TempFile AbsFile tfHandle :: Lens' TempFile Handle tempFile :: AbsDir -> RelFile -> Managed TempFile -- | Monads in which IO computations may be embedded. Any monad -- built by applying a sequence of monad transformers to the IO -- monad will be an instance of this class. -- -- Instances should satisfy the following laws, which state that -- liftIO is a transformer of monads: -- -- class Monad m => MonadIO (m :: * -> *) -- | Lift a computation from the IO monad. liftIO :: MonadIO m => IO a -> m a -- | Lift a computation from the IO monad. liftIO :: MonadIO m => forall a. IO a -> m a -- | Computation hSeek hdl mode i sets the position of -- handle hdl depending on mode. The offset i -- is given in terms of 8-bit bytes. -- -- If hdl is block- or line-buffered, then seeking to a position -- which is not in the current buffer will first cause any items in the -- output buffer to be written to the device, and then cause the input -- buffer to be discarded. Some handles may not be seekable (see -- hIsSeekable), or only support a subset of the possible -- positioning operations (for instance, it may only be possible to seek -- to the end of a tape, or to a positive offset from the beginning or -- current position). It is not possible to set a negative I/O position, -- or for a physical file, an I/O position beyond the current -- end-of-file. -- -- This operation may fail with: -- -- hSeek :: Handle -> SeekMode -> Integer -> IO () -- | A mode that determines the effect of hSeek hdl mode -- i. data SeekMode :: * -- | the position of hdl is set to i. AbsoluteSeek :: SeekMode -- | the position of hdl is set to offset i from the -- current position. RelativeSeek :: SeekMode -- | the position of hdl is set to offset i from the end -- of the file. SeekFromEnd :: SeekMode file :: AbsRelFile -> IOMode -> Managed Handle