Copyright | (C) 2016 Jason Johnson |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Jason Johnson <jason.johnson.081@gmail.com> |
Stability | experimental |
Portability | TBD |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A Pattern
is used to parse and format types in this library.
Synopsis
- data Pattern a b r = Pattern {
- _patParse :: Parser a r
- _patFormat :: Format r b
- parse :: (MonadThrow m, DefaultForParse a) => Pattern (a -> a) b String -> SourceName -> m a
- parse' :: MonadThrow m => Pattern (a -> a) b String -> SourceName -> a -> m a
- format :: Pattern a r String -> r
- string :: String -> Pattern String String String
- char :: Char -> Pattern Char String String
- (<%) :: Pattern a b r -> Pattern c r r -> Pattern a b r
- data ParseFailedException
Types
Pattern | |
|
Instances
Semigroup (Pattern (a -> a) (b -> r) r) Source # | |
Defined in Data.HodaTime.Pattern.Internal |
Parsing / Formatting
parse :: (MonadThrow m, DefaultForParse a) => Pattern (a -> a) b String -> SourceName -> m a Source #
parse' :: MonadThrow m => Pattern (a -> a) b String -> SourceName -> a -> m a Source #
Like parse
above but lets the user provide an a
as the default to use
Standard Patterns
Custom Patterns
Used to create specialized patterns
(<%) :: Pattern a b r -> Pattern c r r -> Pattern a b r Source #
Merge a pattern that operates on a data type with a static pattern
Exceptions
data ParseFailedException Source #
Parse failed on the given string
Instances
Exception ParseFailedException Source # | |
Show ParseFailedException Source # | |
Defined in Data.HodaTime.Pattern.Internal showsPrec :: Int -> ParseFailedException -> ShowS # show :: ParseFailedException -> String # showList :: [ParseFailedException] -> ShowS # |