| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Predicate.Data.String
Description
promoted String functions
Documentation
similar to strip
>>>pz @(TrimBoth (Snd Id)) (20," abc " :: String)PresentT "abc"
>>>pz @(TrimBoth (Snd Id)) (20,T.pack " abc ")PresentT "abc"
>>>pz @(TrimBoth " ") ()PresentT ""
>>>pz @(TrimBoth "") ()PresentT ""
similar to stripStart
>>>pz @(TrimL (Snd Id)) (20," abc ")PresentT "abc "
similar to stripEnd
>>>pz @(TrimR (Snd Id)) (20," abc ")PresentT " abc"
>>>pz @(TrimR " abc ") ()PresentT " abc"
>>>pz @(TrimR "") ()PresentT ""
similar to stripRight
>>>pz @(StripR "xyz" Id) "Hello xyz"PresentT (Just "Hello ")
>>>pz @(StripR "xyz" Id) "xyzHelloxyw"PresentT Nothing
>>>pz @(StripR "xyz" Id) ""PresentT Nothing
>>>pz @(StripR "xyz" "xyz") ()PresentT (Just "")
similar to stripLeft
>>>pz @(StripL "xyz" Id) ("xyzHello" :: String)PresentT (Just "Hello")
>>>pz @(StripL "xyz" Id) (T.pack "xyzHello")PresentT (Just "Hello")
>>>pz @(StripL "xyz" Id) "xywHello"PresentT Nothing
similar to isPrefixOf for strings
>>>pl @(IsPrefix "xy" Id) "xyzabw"True (IsPrefix(xy) xyzabw) TrueT
>>>pl @(IsPrefix "ab" Id) "xyzbaw"False (IsPrefix(ab) xyzbaw) FalseT
similar to isInfixOf for strings
>>>pl @(IsInfix "ab" Id) "xyzabw"True (IsInfix(ab) xyzabw) TrueT
>>>pl @(IsInfix "aB" Id) "xyzAbw"False (IsInfix(aB) xyzAbw) FalseT
>>>pl @(IsInfix "ab" Id) "xyzbaw"False (IsInfix(ab) xyzbaw) FalseT
>>>pl @(IsInfix (Fst Id) (Snd Id)) ("ab","xyzabw")True (IsInfix(ab) xyzabw) TrueT
similar to isSuffixOf for strings
>>>pl @(IsSuffix "bw" Id) "xyzabw"True (IsSuffix(bw) xyzabw) TrueT
>>>pl @(IsSuffix "bw" Id) "xyzbaw"False (IsSuffix(bw) xyzbaw) FalseT
similar to case insensitive isPrefixOf for strings
similar to case insensitive isInfixOf for strings
>>>pl @(IsInfixI "aB" Id) "xyzAbw"True (IsInfixI(aB) xyzAbw) TrueT
similar to case insensitive isSuffixOf for strings
very simple conversion 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"PresentT (Identity "abc")
>>>pz @(FromString (Seq.Seq Char) Id) "abc"PresentT (fromList "abc")
Instances
| P (FromStringPT t p) x => P (FromString t p :: Type) x Source # | |
Defined in Predicate.Data.String Associated Types type PP (FromString t p) x :: Type Source # Methods eval :: MonadEval m => proxy (FromString t p) -> POpts -> x -> m (TT (PP (FromString t p) x)) Source # | |
| type PP (FromString t p :: Type) x Source # | |
Defined in Predicate.Data.String | |
data FromString' t s Source #
fromString function where you need to provide the type 't' of the result
Instances
| (P s a, PP s a ~ String, Show (PP t a), IsString (PP t a)) => P (FromString' t s :: Type) a Source # | |
Defined in Predicate.Data.String Associated Types type PP (FromString' t s) a :: Type Source # Methods eval :: MonadEval m => proxy (FromString' t s) -> POpts -> a -> m (TT (PP (FromString' t s) a)) Source # | |
| type PP (FromString' t s :: Type) a Source # | |
Defined in Predicate.Data.String | |