monopati-0.1.2: Well-typed paths

Safe HaskellSafe
LanguageHaskell2010

System.Monopati.Posix

Contents

Synopsis

CRUD operations for filesystem

current :: IO (Maybe (Absolute Path To Directory)) Source #

Return Nothing, if current working directory is root (cwd)

home :: IO (Maybe (Absolute Path To Directory)) Source #

Retrieve absolute path of home directory (echo ~)

create :: Absolute Path To Directory -> IO () Source #

Create a directory (mkdir)

change :: Absolute Path To Directory -> IO () Source #

Change directory (cd)

remove :: Absolute Path To Directory -> IO () Source #

Remove directory (rm -rf)

Pure combinators

data Points Source #

What the path points to?

Constructors

Directory 
File 

data Origin Source #

What is the beginning of the path?

Constructors

Root

(/) Starting point for absolute path

Home

(~/) Indication of home directory

Vague

Uncertain relative path

data To Source #

Dummy type needed only for beautiful type declarations

type Path = Cofree Maybe String Source #

Path is non-empty sequence of folders or file (in the end)

newtype Outline (origin :: Origin) (points :: Points) Source #

The internal type of path representation

Constructors

Outline 

Fields

Instances
Read (Outline Root Directory) Source # 
Instance details

Defined in System.Monopati.Posix.Combinators

Read (Outline Root File) Source # 
Instance details

Defined in System.Monopati.Posix.Combinators

Read (Outline Home Directory) Source # 
Instance details

Defined in System.Monopati.Posix.Combinators

Read (Outline Home File) Source # 
Instance details

Defined in System.Monopati.Posix.Combinators

Read (Outline Vague Directory) Source # 
Instance details

Defined in System.Monopati.Posix.Combinators

Read (Outline Vague File) Source # 
Instance details

Defined in System.Monopati.Posix.Combinators

Show (Outline Root Directory) Source # 
Instance details

Defined in System.Monopati.Posix.Combinators

Show (Outline Root File) Source # 
Instance details

Defined in System.Monopati.Posix.Combinators

Show (Outline Home Directory) Source # 
Instance details

Defined in System.Monopati.Posix.Combinators

Show (Outline Home File) Source # 
Instance details

Defined in System.Monopati.Posix.Combinators

Show (Outline Vague Directory) Source # 
Instance details

Defined in System.Monopati.Posix.Combinators

Show (Outline Vague File) Source # 
Instance details

Defined in System.Monopati.Posix.Combinators

type family Absolute (path :: Type) (to :: Type) (points :: Points) :: Type where ... Source #

Equations

Absolute Path To points = Outline Root points 

type family Homeward (path :: Type) (to :: Type) (points :: Points) :: Type where ... Source #

Equations

Homeward Path To points = Outline Home points 

type family Relative (path :: Type) (to :: Type) (points :: Points) :: Type where ... Source #

Equations

Relative Path To points = Outline Vague points 

deeper :: Relative Path To points -> Maybe (Relative Path To points) Source #

Take the next piece of relative path

part :: String -> Outline origin points Source #

Immerse string into a path, filter slashes

parent :: Absolute Path To points -> Maybe (Absolute Path To Directory) Source #

Take parent directory of current pointed entity

(<^>) :: Relative Path To Directory -> Relative Path To points -> Relative Path To points Source #

"usr/local/" + "etc/" = "usr/local/etc/"

(</>) :: Absolute Path To Directory -> Relative Path To points -> Absolute Path To points Source #

"/usr/bin/" + "git" = "/usr/bin/git"

(<~/>) :: Absolute Path To points -> Homeward Path To points -> Absolute Path To points Source #

"/usr/local/" + "~/etc/" = "/usr/local/etc/"