Copyright | (C) 2012-16 Edward Kmett |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | Rank2Types |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- (</>~) :: ASetter s t FilePath FilePath -> FilePath -> s -> t
- (<</>~) :: LensLike ((,) FilePath) s a FilePath FilePath -> FilePath -> s -> (FilePath, a)
- (<<</>~) :: Optical' (->) q ((,) FilePath) s FilePath -> FilePath -> q s (FilePath, s)
- (<.>~) :: ASetter s a FilePath FilePath -> String -> s -> a
- (<<.>~) :: LensLike ((,) FilePath) s a FilePath FilePath -> String -> s -> (FilePath, a)
- (<<<.>~) :: Optical' (->) q ((,) FilePath) s FilePath -> String -> q s (FilePath, s)
- (</>=) :: MonadState s m => ASetter' s FilePath -> FilePath -> m ()
- (<</>=) :: MonadState s m => LensLike' ((,) FilePath) s FilePath -> FilePath -> m FilePath
- (<<</>=) :: MonadState s m => LensLike' ((,) FilePath) s FilePath -> FilePath -> m FilePath
- (<.>=) :: MonadState s m => ASetter' s FilePath -> String -> m ()
- (<<.>=) :: MonadState s m => LensLike' ((,) FilePath) s FilePath -> String -> m FilePath
- (<<<.>=) :: MonadState s m => LensLike' ((,) FilePath) s FilePath -> String -> m FilePath
- basename :: Lens' FilePath FilePath
- directory :: Lens' FilePath FilePath
- extension :: Lens' FilePath FilePath
- filename :: Lens' FilePath FilePath
Operators
(</>~) :: ASetter s t FilePath FilePath -> FilePath -> s -> t infixr 4 Source #
Modify the path by adding another path.
>>>
(both </>~ "bin" $ ("hello","world")) == ("hello" </> "bin", "world" </> "bin")
True
(</>~
) ::ReifiedSetter
s aFilePath
FilePath
->FilePath
-> s -> a (</>~
) ::ReifiedIso
s aFilePath
FilePath
->FilePath
-> s -> a (</>~
) ::ReifiedLens
s aFilePath
FilePath
->FilePath
-> s -> a (</>~
) ::ReifiedTraversal
s aFilePath
FilePath
->FilePath
-> s -> a
(<</>~) :: LensLike ((,) FilePath) s a FilePath FilePath -> FilePath -> s -> (FilePath, a) infixr 4 Source #
Add a path onto the end of the target of a ReifiedLens
and return the result
When you do not need the result of the operation, (</>~
) is more flexible.
(<<</>~) :: Optical' (->) q ((,) FilePath) s FilePath -> FilePath -> q s (FilePath, s) infixr 4 Source #
Add a path onto the end of the target of a ReifiedLens
and return the original
value.
When you do not need the original value, (</>~
) is more flexible.
(<.>~) :: ASetter s a FilePath FilePath -> String -> s -> a infixr 4 Source #
Modify the path by adding an extension.
>>>
both <.>~ "txt" $ ("hello","world")
("hello.txt","world.txt")
(<.>~
) ::ReifiedSetter
s aFilePath
FilePath
->String
-> s -> a (<.>~
) ::ReifiedIso
s aFilePath
FilePath
->String
-> s -> a (<.>~
) ::ReifiedLens
s aFilePath
FilePath
->String
-> s -> a (<.>~
) ::ReifiedTraversal
s aFilePath
FilePath
->String
-> s -> a
(<<.>~) :: LensLike ((,) FilePath) s a FilePath FilePath -> String -> s -> (FilePath, a) infixr 4 Source #
Add an extension onto the end of the target of a ReifiedLens
and return the result
>>>
_1 <<.>~ "txt" $ ("hello","world")
("hello.txt",("hello.txt","world"))
When you do not need the result of the operation, (<.>~
) is more flexible.
(<<<.>~) :: Optical' (->) q ((,) FilePath) s FilePath -> String -> q s (FilePath, s) infixr 4 Source #
Add an extension onto the end of the target of a ReifiedLens
but
return the old value
>>>
_1 <<<.>~ "txt" $ ("hello","world")
("hello",("hello.txt","world"))
When you do not need the old value, (<.>~
) is more flexible.
(</>=) :: MonadState s m => ASetter' s FilePath -> FilePath -> m () infix 4 Source #
Modify the target(s) of a Lens'
, Iso'
, Setter'
or Traversal'
by adding a path.
>>>
execState (both </>= "bin") ("hello","world") == ("hello" </> "bin", "world" </> "bin")
True
(</>=
) ::MonadState
s m =>Setter'
sFilePath
->FilePath
-> m () (</>=
) ::MonadState
s m =>Iso'
sFilePath
->FilePath
-> m () (</>=
) ::MonadState
s m =>Lens'
sFilePath
->FilePath
-> m () (</>=
) ::MonadState
s m =>Traversal'
sFilePath
->FilePath
-> m ()
(<</>=) :: MonadState s m => LensLike' ((,) FilePath) s FilePath -> FilePath -> m FilePath infix 4 Source #
Add a path onto the end of the target of a ReifiedLens
into
your monad's state and return the result.
When you do not need the result of the operation, (</>=
) is more flexible.
(<<</>=) :: MonadState s m => LensLike' ((,) FilePath) s FilePath -> FilePath -> m FilePath infix 4 Source #
Add a path onto the end of a target of a ReifiedLens
into your monad's state
and return the old value.
When you do not need the result of the operation, (</>=
) is more flexible.
(<.>=) :: MonadState s m => ASetter' s FilePath -> String -> m () infix 4 Source #
Modify the target(s) of a Lens'
, Iso'
, Setter'
or Traversal'
by adding an extension.
>>>
execState (both <.>= "txt") ("hello","world")
("hello.txt","world.txt")
(<.>=
) ::MonadState
s m =>Setter'
sFilePath
->String
-> m () (<.>=
) ::MonadState
s m =>Iso'
sFilePath
->String
-> m () (<.>=
) ::MonadState
s m =>Lens'
sFilePath
->String
-> m () (<.>=
) ::MonadState
s m =>Traversal'
sFilePath
->String
-> m ()
(<<.>=) :: MonadState s m => LensLike' ((,) FilePath) s FilePath -> String -> m FilePath infix 4 Source #
Add an extension onto the end of the target of a ReifiedLens
into
your monad's state and return the result.
>>>
evalState (_1 <<.>= "txt") ("hello","world")
"hello.txt"
When you do not need the result of the operation, (<.>=
) is more flexible.
(<<<.>=) :: MonadState s m => LensLike' ((,) FilePath) s FilePath -> String -> m FilePath infix 4 Source #
Add an extension onto the end of the target of a ReifiedLens
into your monad's
state and return the old value.
>>>
runState (_1 <<<.>= "txt") ("hello","world")
("hello",("hello.txt","world"))
When you do not need the old value, (<.>=
) is more flexible.
Lenses
basename :: Lens' FilePath FilePath Source #
A ReifiedLens
for reading and writing to the basename
Note: This is not
a legal ReifiedLens
unless the outer FilePath
has both a directory
and filename component and the generated basenames are not null and contain no directory
separators.
>>>
(basename .~ "filename" $ "path" </> "name.png") == "path" </> "filename.png"
True
directory :: Lens' FilePath FilePath Source #
A ReifiedLens
for reading and writing to the directory
Note: this is not a legal ReifiedLens
unless the outer FilePath
already has a directory component,
and generated directories are not null.
>>>
(("long" </> "path" </> "name.txt") ^. directory) == "long" </> "path"
True
extension :: Lens' FilePath FilePath Source #
A ReifiedLens
for reading and writing to the extension
Note: This is not a legal ReifiedLens
, unless you are careful to ensure that generated
extension FilePath
components are either null or start with extSeparator
and do not contain any internal extSeparator
s.
>>>
(extension .~ ".png" $ "path" </> "name.txt") == "path" </> "name.png"
True
filename :: Lens' FilePath FilePath Source #
A ReifiedLens
for reading and writing to the full filename
Note: This is not a legal ReifiedLens
, unless you are careful to ensure that generated
filename FilePath
components are not null and do not contain any
elements of pathSeparators
s.
>>>
(filename .~ "name.txt" $ "path" </> "name.png") == "path" </> "name.txt"
True