Safe Haskell | None |
---|---|
Language | Haskell2010 |
promoted String functions
Synopsis
- data ToString
- class ToStringC (a :: Type) where
- data FromString (t :: Type) p
- data FromString' t p
- data IsPrefixCI p q
- data IsInfixCI p q
- data IsSuffixCI p q
- data TrimBoth
- data TrimL
- data TrimR
- data StripR p q
- data StripL p q
converters
very simple conversion to a string
class ToStringC (a :: Type) where Source #
convert string-like value to a string
data FromString (t :: Type) p Source #
fromString
function where you need to provide the type t
of the result
>>>
pz @(FromString (Identity _) Id) "abc"
Val (Identity "abc")
>>>
pz @(FromString (Seq.Seq Char) Id) "abc"
Val (fromList "abc")
Instances
P (FromStringT t p) x => P (FromString t p :: Type) x Source # | |
Defined in Predicate.Data.String type PP (FromString t p) x Source # eval :: MonadEval m => proxy (FromString t p) -> POpts -> x -> m (TT (PP (FromString t p) x)) Source # | |
Show (FromString t p) Source # | |
Defined in Predicate.Data.String showsPrec :: Int -> FromString t p -> ShowS # show :: FromString t p -> String # showList :: [FromString t p] -> ShowS # | |
type PP (FromString t p :: Type) x Source # | |
Defined in Predicate.Data.String |
data FromString' t p Source #
fromString
function where you need to provide a reference to the type t
of the result
Instances
(P p a, PP p a ~ String, Show (PP t a), IsString (PP t a)) => P (FromString' t p :: Type) a Source # | |
Defined in Predicate.Data.String type PP (FromString' t p) a Source # eval :: MonadEval m => proxy (FromString' t p) -> POpts -> a -> m (TT (PP (FromString' t p) a)) Source # | |
Show (FromString' t p) Source # | |
Defined in Predicate.Data.String showsPrec :: Int -> FromString' t p -> ShowS # show :: FromString' t p -> String # showList :: [FromString' t p] -> ShowS # | |
type PP (FromString' t p :: Type) a Source # | |
Defined in Predicate.Data.String |
predicates
data IsPrefixCI p q Source #
similar to case insensitive isPrefixOf
for strings
>>>
pz @(IsPrefixCI "abc" "aBcbCd") ()
Val True
Instances
P (IsPrefixCIT p q) x => P (IsPrefixCI p q :: Type) x Source # | |
Defined in Predicate.Data.String type PP (IsPrefixCI p q) x Source # eval :: MonadEval m => proxy (IsPrefixCI p q) -> POpts -> x -> m (TT (PP (IsPrefixCI p q) x)) Source # | |
Show (IsPrefixCI p q) Source # | |
Defined in Predicate.Data.String showsPrec :: Int -> IsPrefixCI p q -> ShowS # show :: IsPrefixCI p q -> String # showList :: [IsPrefixCI p q] -> ShowS # | |
type PP (IsPrefixCI p q :: Type) x Source # | |
Defined in Predicate.Data.String |
similar to case insensitive isInfixOf
for strings
>>>
pl @(IsInfixCI "aB" Id) "xyzAbw"
True (IsInfixCI | aB xyzAbw) Val True
>>>
pz @(IsInfixCI "abc" "axAbCd") ()
Val True
data IsSuffixCI p q Source #
similar to case insensitive isSuffixOf
for strings
Instances
P (IsSuffixCIT p q) x => P (IsSuffixCI p q :: Type) x Source # | |
Defined in Predicate.Data.String type PP (IsSuffixCI p q) x Source # eval :: MonadEval m => proxy (IsSuffixCI p q) -> POpts -> x -> m (TT (PP (IsSuffixCI p q) x)) Source # | |
Show (IsSuffixCI p q) Source # | |
Defined in Predicate.Data.String showsPrec :: Int -> IsSuffixCI p q -> ShowS # show :: IsSuffixCI p q -> String # showList :: [IsSuffixCI p q] -> ShowS # | |
type PP (IsSuffixCI p q :: Type) x Source # | |
Defined in Predicate.Data.String |
mutators
similar to strip
>>>
pz @(Snd >> TrimBoth) (20," abc ")
Val "abc"
>>>
pz @(Snd >> TrimBoth) (20,T.pack " abc ")
Val "abc"
>>>
pz @(" " >> TrimBoth) ()
Val ""
>>>
pz @("" >> TrimBoth) ()
Val ""
similar to stripStart
>>>
pz @(Snd >> TrimL) (20," abc ")
Val "abc "
similar to stripEnd
>>>
pz @(Snd >> TrimR) (20," abc ")
Val " abc"
>>>
pz @(" abc " >> TrimR) ()
Val " abc"
>>>
pz @("" >> TrimR) ()
Val ""
similar to stripRight
>>>
pz @(StripR "xyz" Id) "Hello xyz"
Val (Just "Hello ")
>>>
pz @(StripR "xyz" Id) "xyzHelloxyw"
Val Nothing
>>>
pz @(StripR "xyz" Id) ""
Val Nothing
>>>
pz @(StripR "xyz" "xyz") ()
Val (Just "")
similar to stripLeft
>>>
pz @(StripL "xyz" Id) "xyzHello"
Val (Just "Hello")
>>>
pz @(StripL "xyz" Id) (T.pack "xyzHello")
Val (Just "Hello")
>>>
pz @(StripL "xyz" Id) "xywHello"
Val Nothing