Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Text1 = Text1 Char Text
- length1 :: Text1 -> Int
- compareLength1 :: Text1 -> Int -> Ordering
- _head1 :: Lens' Text1 Char
- _tail1 :: Lens' Text1 Text
- _last1 :: Lens' Text1 Char
- _init1 :: Lens' Text1 Text
- class AsText1 p f s where
- class IsText1 t where
- class AsSingle c a | c -> a where
- class OneAnd s t a b x y | s -> a, s -> x, t -> b, t -> y, s b -> t, x b -> t, t a -> s, y a -> s where
Documentation
Eq Text1 Source | |
Data Text1 Source | |
Ord Text1 Source | |
Show Text1 Source | |
Binary Text1 Source | |
Semigroup Text1 Source | ((x <> y) <> z) == (x <> (y <> z :: Text1)) |
Reversing Text1 Source | |
IsText1 Text1 Source | |
AsSingle Text1 Char Source | |
AsText1 p f Text1 Source | |
Cons Text1 Text1 Char Char Source | |
Snoc Text1 Text1 Char Char Source | |
OneAnd Text1 Text1 Char Char Text Text Source |
length1 :: Text1 -> Int Source
>>>
fmap length1 ("a" ^? _Text1)
Just 1
>>>
fmap length1 ("abc" ^? _Text1)
Just 3
length1 t >= 1
compareLength1 :: Text1 -> Int -> Ordering Source
>>>
fmap (`compareLength1` 1) ("a" ^? _Text1)
Just EQ
>>>
fmap (`compareLength1` 3) ("a" ^? _Text1)
Just LT
>>>
fmap (`compareLength1` 1) ("abc" ^? _Text1)
Just GT
>>>
fmap (`compareLength1` 3) ("abc" ^? _Text1)
Just EQ
>>>
fmap (`compareLength1` 5) ("abc" ^? _Text1)
Just LT
compareLength1 t 1 /= LT
_head1 :: Lens' Text1 Char Source
>>>
fmap (^. _head1) ("a" ^? _Text1)
Just 'a'
>>>
fmap (^. _head1) ("abc" ^? _Text1)
Just 'a'
>>>
fmap (_head1 %~ toUpper) ("abc" ^? _Text1)
Just "Abc"
_tail1 :: Lens' Text1 Text Source
>>>
fmap (^. _tail1) ("a" ^? _Text1)
Just ""
>>>
fmap (^. _tail1) ("abc" ^? _Text1)
Just "bc"
>>>
fmap (_tail1 %~ Text.toUpper) ("abc" ^? _Text1)
Just "aBC"
_last1 :: Lens' Text1 Char Source
>>>
fmap (^. _last1) ("a" ^? _Text1)
Just 'a'
>>>
fmap (^. _last1) ("abc" ^? _Text1)
Just 'c'
>>>
fmap (_last1 %~ toUpper) ("abc" ^? _Text1)
Just "abC"
_init1 :: Lens' Text1 Text Source
>>>
fmap (^. _init1) ("a" ^? _Text1)
Just ""
>>>
fmap (^. _init1) ("abc" ^? _Text1)
Just "ab"
>>>
fmap (_init1 %~ Text.toUpper) ("a" ^? _Text1)
Just "a"
>>>
fmap (_init1 %~ Text.toUpper) ("abc" ^? _Text1)
Just "ABc"