polysemy-scoped-fs-0.1.0.0: Well-typed filesystem operation effects.
Copyright(c) Hisaket VioletRed 2022
LicenseAGPL-3.0-or-later
Maintainerhisaket@outlook.jp
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Polysemy.SequentialAccess

Description

 
Synopsis

Documentation

data GetPosition pos m a where Source #

An effect that gets the current cursor position in the file.

Constructors

GetPosition :: GetPosition pos m pos 

getPosition :: forall pos r. Member (GetPosition pos) r => Sem r pos Source #

data TriPosition Source #

A type that represents both ends or intermediate positions in the file.

Constructors

End Ends 
Intermediate 

data Ends Source #

A type that represents both ends of the file.

Constructors

TOF

Top of file

EOF

End of file

Instances

Instances details
Eq Ends Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

(==) :: Ends -> Ends -> Bool #

(/=) :: Ends -> Ends -> Bool #

Ord Ends Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

compare :: Ends -> Ends -> Ordering #

(<) :: Ends -> Ends -> Bool #

(<=) :: Ends -> Ends -> Bool #

(>) :: Ends -> Ends -> Bool #

(>=) :: Ends -> Ends -> Bool #

max :: Ends -> Ends -> Ends #

min :: Ends -> Ends -> Ends #

Show Ends Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

showsPrec :: Int -> Ends -> ShowS #

show :: Ends -> String #

showList :: [Ends] -> ShowS #

data Seek pos m a where Source #

An effect that moves the cursor.

Constructors

Seek :: pos -> Seek pos m () 

seek :: forall pos r. Member (Seek pos) r => pos -> Sem r () Source #

newtype Absolute a Source #

A wrapper type that represents an absolute position in the file.

Constructors

Absolute a 

Instances

Instances details
Eq a => Eq (Absolute a) Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

(==) :: Absolute a -> Absolute a -> Bool #

(/=) :: Absolute a -> Absolute a -> Bool #

Ord a => Ord (Absolute a) Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

compare :: Absolute a -> Absolute a -> Ordering #

(<) :: Absolute a -> Absolute a -> Bool #

(<=) :: Absolute a -> Absolute a -> Bool #

(>) :: Absolute a -> Absolute a -> Bool #

(>=) :: Absolute a -> Absolute a -> Bool #

max :: Absolute a -> Absolute a -> Absolute a #

min :: Absolute a -> Absolute a -> Absolute a #

Show a => Show (Absolute a) Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

showsPrec :: Int -> Absolute a -> ShowS #

show :: Absolute a -> String #

showList :: [Absolute a] -> ShowS #

newtype Relative a Source #

A wrapper type that represents relative position from the current cursor position.

Constructors

Relative a 

Instances

Instances details
Eq a => Eq (Relative a) Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

(==) :: Relative a -> Relative a -> Bool #

(/=) :: Relative a -> Relative a -> Bool #

Ord a => Ord (Relative a) Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

compare :: Relative a -> Relative a -> Ordering #

(<) :: Relative a -> Relative a -> Bool #

(<=) :: Relative a -> Relative a -> Bool #

(>) :: Relative a -> Relative a -> Bool #

(>=) :: Relative a -> Relative a -> Bool #

max :: Relative a -> Relative a -> Relative a #

min :: Relative a -> Relative a -> Relative a #

Show a => Show (Relative a) Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

showsPrec :: Int -> Relative a -> ShowS #

show :: Relative a -> String #

showList :: [Relative a] -> ShowS #

newtype FromEnd a Source #

A wrapper type that represents relative position from the end of the file.

Constructors

FromEnd a 

Instances

Instances details
Eq a => Eq (FromEnd a) Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

(==) :: FromEnd a -> FromEnd a -> Bool #

(/=) :: FromEnd a -> FromEnd a -> Bool #

Ord a => Ord (FromEnd a) Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

compare :: FromEnd a -> FromEnd a -> Ordering #

(<) :: FromEnd a -> FromEnd a -> Bool #

(<=) :: FromEnd a -> FromEnd a -> Bool #

(>) :: FromEnd a -> FromEnd a -> Bool #

(>=) :: FromEnd a -> FromEnd a -> Bool #

max :: FromEnd a -> FromEnd a -> FromEnd a #

min :: FromEnd a -> FromEnd a -> FromEnd a #

Show a => Show (FromEnd a) Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

showsPrec :: Int -> FromEnd a -> ShowS #

show :: FromEnd a -> String #

showList :: [FromEnd a] -> ShowS #

data Read sz i m a where Source #

An effect that gets file contents by the size sz from the current position.

Constructors

Read :: sz -> Read sz i m i 

read :: forall sz i r. Member (Read sz i) r => sz -> Sem r i Source #

type ReadToEnd = Read ToEnd Source #

An effect that gets file contents from current position to the end of the file.

data ToEnd Source #

A singleton that represents the size from the current position to the end of the file.

Constructors

ToEnd 

Instances

Instances details
Eq ToEnd Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

(==) :: ToEnd -> ToEnd -> Bool #

(/=) :: ToEnd -> ToEnd -> Bool #

Ord ToEnd Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

compare :: ToEnd -> ToEnd -> Ordering #

(<) :: ToEnd -> ToEnd -> Bool #

(<=) :: ToEnd -> ToEnd -> Bool #

(>) :: ToEnd -> ToEnd -> Bool #

(>=) :: ToEnd -> ToEnd -> Bool #

max :: ToEnd -> ToEnd -> ToEnd #

min :: ToEnd -> ToEnd -> ToEnd #

Show ToEnd Source # 
Instance details

Defined in Polysemy.SequentialAccess

Methods

showsPrec :: Int -> ToEnd -> ShowS #

show :: ToEnd -> String #

showList :: [ToEnd] -> ShowS #

data NullSize Source #

A singleton that represents the size 0.

Constructors

NullSize 

Instances

Instances details
Eq NullSize Source # 
Instance details

Defined in Polysemy.SequentialAccess

Ord NullSize Source # 
Instance details

Defined in Polysemy.SequentialAccess

Show NullSize Source # 
Instance details

Defined in Polysemy.SequentialAccess

inputToRead :: Member (Read sz i) r => sz -> Sem (Input i ': r) a -> Sem r a Source #

Transforms an Input effect into an Read effect with the fixed size.

data Overwrite o m a where Source #

An effect that overwrites file contents by the data o from current position.

Constructors

Overwrite :: o -> Overwrite o m () 

overwrite :: forall o r. Member (Overwrite o) r => o -> Sem r () Source #

outputToOverwrite :: Member (Overwrite o) r => Sem (Output o ': r) a -> Sem r a Source #

Transforms an Output effect into an Overwrite effect.

data Extend o m a where Source #

An effect that extends a file by the data o from the end of a file. The cursor is not moved.

Constructors

Extend :: o -> Extend o m () 

extend :: forall o r. Member (Extend o) r => o -> Sem r () Source #

data Append o m a where Source #

An effect that extends a file by the data o from the end of a file. The cursor is moved to the end of the file after extending.

Constructors

Append :: o -> Append o m () 

append :: forall o r. Member (Append o) r => o -> Sem r () Source #

outputToExtend :: Member (Extend o) r => Sem (Output o ': r) a -> Sem r a Source #

Transforms an Output effect into an Extend effect.

outputToAppend :: Member (Append o) r => Sem (Output o ': r) a -> Sem r a Source #

Transforms an Output effect into an Append effect.

data Resize sz m a where Source #

An effect that resizes a file by the size sz.

Note: The initial data in space made by a growing is interpreter-dependent.

Constructors

Resize :: sz -> Resize sz m () 

resize :: forall sz r. Member (Resize sz) r => sz -> Sem r () Source #