Copyright | (C) CSIRO 2017-2018 |
---|---|
License | BSD3 |
Maintainer | George Wilson <george.wilson@data61.csiro.au> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
A sum type for space characters
- data HorizontalSpace
- class AsHorizontalSpace r where
- type Spaces = Vector HorizontalSpace
- single :: Spaces
- manySpaces :: Int -> Spaces
- tab :: Spaces
- spaceToChar :: HorizontalSpace -> Char
- charToSpace :: Char -> Maybe HorizontalSpace
- spacesText :: Prism' Text Spaces
- spacesString :: Prism' String Spaces
- data Spaced a = Spaced {}
- class HasSpaced s t a b | s -> a, t -> b, s b -> t, t a -> s where
- betwixt :: Spaces -> a -> Spaces -> Spaced a
- uniform :: Spaces -> a -> Spaced a
- unspaced :: a -> Spaced a
- removeSpaces :: Spaced a -> Spaced a
Documentation
data HorizontalSpace Source #
HorizontalSpace
is a subset of Char
. To move back and forth betwen
it and Char
, String
, or Text
, use _HorizontalSpace
class AsHorizontalSpace r where Source #
Classy prisms for HorizontalSpace
s
_HorizontalSpace :: Prism' r HorizontalSpace Source #
manySpaces :: Int -> Spaces Source #
As many spaces as you'd like
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
Spaced
is a value with zero or many horizontal spaces around it on
both sides.
Functor Spaced Source # | |
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 " |
Foldable Spaced Source # | |
Traversable Spaced Source # | |
Eq a => Eq (Spaced a) Source # | |
Ord a => Ord (Spaced a) Source # | |
Show a => Show (Spaced a) Source # | |
Generic (Spaced a) Source # | |
NFData a => NFData (Spaced a) Source # | |
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
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 #
uniform :: Spaces -> a -> Spaced a Source #
uniform
puts the same spacing both before and after something.
removeSpaces :: Spaced a -> Spaced a Source #
Remove spaces from the argument