| 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 | Safe-Inferred |
| Language | Haskell2010 |
System.FilePath.Lens
Description
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
(</>~) ::Setters aFilePathFilePath->FilePath-> s -> a (</>~) ::Isos aFilePathFilePath->FilePath-> s -> a (</>~) ::Lenss aFilePathFilePath->FilePath-> s -> a (</>~) ::Traversals aFilePathFilePath->FilePath-> s -> a
(<</>~) :: LensLike ((,) FilePath) s a FilePath FilePath -> FilePath -> s -> (FilePath, a) infixr 4 Source #
(<<</>~) :: Optical' (->) q ((,) FilePath) s FilePath -> FilePath -> q s (FilePath, s) infixr 4 Source #
(<.>~) :: 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")
(<.>~) ::Setters aFilePathFilePath->String-> s -> a (<.>~) ::Isos aFilePathFilePath->String-> s -> a (<.>~) ::Lenss aFilePathFilePath->String-> s -> a (<.>~) ::Traversals aFilePathFilePath->String-> s -> a
(<<.>~) :: LensLike ((,) FilePath) s a FilePath FilePath -> String -> s -> (FilePath, a) infixr 4 Source #
(<<<.>~) :: Optical' (->) q ((,) FilePath) s FilePath -> String -> q s (FilePath, s) infixr 4 Source #
(</>=) :: 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
(</>=) ::MonadStates m =>Setter'sFilePath->FilePath-> m () (</>=) ::MonadStates m =>Iso'sFilePath->FilePath-> m () (</>=) ::MonadStates m =>Lens'sFilePath->FilePath-> m () (</>=) ::MonadStates m =>Traversal'sFilePath->FilePath-> m ()
(<</>=) :: MonadState s m => LensLike' ((,) FilePath) s FilePath -> FilePath -> m FilePath infix 4 Source #
(<<</>=) :: MonadState s m => LensLike' ((,) FilePath) s FilePath -> FilePath -> m FilePath infix 4 Source #
(<.>=) :: 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")
(<.>=) ::MonadStates m =>Setter'sFilePath->String-> m () (<.>=) ::MonadStates m =>Iso'sFilePath->String-> m () (<.>=) ::MonadStates m =>Lens'sFilePath->String-> m () (<.>=) ::MonadStates m =>Traversal'sFilePath->String-> m ()
(<<.>=) :: MonadState s m => LensLike' ((,) FilePath) s FilePath -> String -> m FilePath infix 4 Source #
(<<<.>=) :: MonadState s m => LensLike' ((,) FilePath) s FilePath -> String -> m FilePath infix 4 Source #
Lenses
basename :: Lens' FilePath FilePath Source #
A Lens for reading and writing to the basename
Note: This is not a legal Lens 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
extension :: Lens' FilePath FilePath Source #
A Lens for reading and writing to the extension
Note: This is not a legal Lens, unless you are careful to ensure that generated
extension FilePath components are either null or start with extSeparator
and do not contain any internal extSeparators.
>>>(extension .~ ".png" $ "path" </> "name.txt") == "path" </> "name.png"True
filename :: Lens' FilePath FilePath Source #
A Lens for reading and writing to the full filename
Note: This is not a legal Lens, unless you are careful to ensure that generated
filename FilePath components are not null and do not contain any
elements of pathSeparatorss.
>>>(filename .~ "name.txt" $ "path" </> "name.png") == "path" </> "name.txt"True