sv-0.1: Encode and decode separated values (CSV, PSV, ...)

Copyright(C) CSIRO 2017-2018
LicenseBSD3
MaintainerGeorge Wilson <george.wilson@data61.csiro.au>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Text.Space

Description

A sum type for space characters

Synopsis

Documentation

type Spaces = Vector HorizontalSpace Source #

Helpful alias for lists of Spaces

single :: Spaces Source #

One space

manySpaces :: Int -> Spaces Source #

As many spaces as you'd like

tab :: Spaces Source #

One tab

spaceToChar :: HorizontalSpace -> Char Source #

Turn a Space into a Char. To go the other way, see charToSpace

charToSpace :: Char -> Maybe HorizontalSpace Source #

Try to turn a Char into a Space. To go the other way, see spaceToChar

spacesText :: Prism' Text Spaces Source #

Parse Text into Spaces, or turn spaces into Text

data Spaced a Source #

Spaced is a value with zero or many horizontal spaces around it on both sides.

Constructors

Spaced 

Fields

Instances

Functor Spaced Source # 

Methods

fmap :: (a -> b) -> Spaced a -> Spaced b #

(<$) :: a -> Spaced b -> Spaced a #

Applicative Spaced Source #

Appends the right parameter on the inside of the left parameter

Spaced "   " () " " *> Spaced "\t\t\t" () "\t \t" == Spaced "   \t\t\t" () "\t \t "

Methods

pure :: a -> Spaced a #

(<*>) :: Spaced (a -> b) -> Spaced a -> Spaced b #

liftA2 :: (a -> b -> c) -> Spaced a -> Spaced b -> Spaced c #

(*>) :: Spaced a -> Spaced b -> Spaced b #

(<*) :: Spaced a -> Spaced b -> Spaced a #

Foldable Spaced Source # 

Methods

fold :: Monoid m => Spaced m -> m #

foldMap :: Monoid m => (a -> m) -> Spaced a -> m #

foldr :: (a -> b -> b) -> b -> Spaced a -> b #

foldr' :: (a -> b -> b) -> b -> Spaced a -> b #

foldl :: (b -> a -> b) -> b -> Spaced a -> b #

foldl' :: (b -> a -> b) -> b -> Spaced a -> b #

foldr1 :: (a -> a -> a) -> Spaced a -> a #

foldl1 :: (a -> a -> a) -> Spaced a -> a #

toList :: Spaced a -> [a] #

null :: Spaced a -> Bool #

length :: Spaced a -> Int #

elem :: Eq a => a -> Spaced a -> Bool #

maximum :: Ord a => Spaced a -> a #

minimum :: Ord a => Spaced a -> a #

sum :: Num a => Spaced a -> a #

product :: Num a => Spaced a -> a #

Traversable Spaced Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Spaced a -> f (Spaced b) #

sequenceA :: Applicative f => Spaced (f a) -> f (Spaced a) #

mapM :: Monad m => (a -> m b) -> Spaced a -> m (Spaced b) #

sequence :: Monad m => Spaced (m a) -> m (Spaced a) #

Eq a => Eq (Spaced a) Source # 

Methods

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

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

Ord a => Ord (Spaced a) Source # 

Methods

compare :: Spaced a -> Spaced a -> Ordering #

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

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

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

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

max :: Spaced a -> Spaced a -> Spaced a #

min :: Spaced a -> Spaced a -> Spaced a #

Show a => Show (Spaced a) Source # 

Methods

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

show :: Spaced a -> String #

showList :: [Spaced a] -> ShowS #

Generic (Spaced a) Source # 

Associated Types

type Rep (Spaced a) :: * -> * #

Methods

from :: Spaced a -> Rep (Spaced a) x #

to :: Rep (Spaced a) x -> Spaced a #

NFData a => NFData (Spaced a) Source # 

Methods

rnf :: Spaced a -> () #

MonadReader (Vector (SpacedField s)) (DecodeState s) # 
HasSpaced (Spaced a) (Spaced b) a b Source # 
type Rep (Spaced a) Source # 

class HasSpaced s t a b | s -> a, t -> b, s b -> t, t a -> s where Source #

Classy lenses for Spaced

Minimal complete definition

spaced

Methods

spaced :: Lens s t (Spaced a) (Spaced b) Source #

after :: s ~ t => Lens s t Spaces Spaces Source #

before :: s ~ t => Lens s t Spaces Spaces Source #

spacedValue :: Lens s t a b Source #

after :: (s ~ t, a ~ b) => Lens s t Spaces Spaces Source #

before :: (s ~ t, a ~ b) => Lens s t Spaces Spaces Source #

spacedValue :: (s ~ t, a ~ b) => Lens s t a b Source #

betwixt :: Spaces -> a -> Spaces -> Spaced a Source #

betwixt is just the constructor for Spaced with a different argument order, which is sometimes useful.

uniform :: Spaces -> a -> Spaced a Source #

uniform puts the same spacing both before and after something.

unspaced :: a -> Spaced a Source #

Places its argument in a Spaced with no spaces.

removeSpaces :: Spaced a -> Spaced a Source #

Remove spaces from the argument