| Copyright | (c) 2016 Al Zohali |
|---|---|
| License | BSD3 |
| Maintainer | Al Zohali <zohl@fmap.me> |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
Anki.Common
Description
Description
Auxiliary functions and types.
- data AnkiException
- newtype WeaklyTypedInt = WeaklyTypedInt {}
- newtype WeaklyTypedBool = WeaklyTypedBool {}
- newtype ModificationTime = ModificationTime {}
- throwErr :: Typeable a => Field -> AnkiException -> Ok a
- getTextValue :: Field -> Ok ByteString
- getJsonValue :: Field -> Ok Value
- fromDictionary :: Typeable a => (Field -> (Text, Value) -> Ok a) -> Field -> Value -> Ok [a]
- mkEntry :: (Typeable a, FromJSON a, Eq b, Typeable b, FromJSON b) => (a -> b) -> AnkiException -> Field -> (Text, Value) -> Ok a
- dropPrefixOptions :: Options
Documentation
data AnkiException Source #
The exception is thrown when something goes wrong with this package.
Constructors
| WrongFieldType | Thrown when column type is not a text. |
| NotJson | Thrown when text from database is not a valid json. |
| WrongJsonFormat | Thrown when json format differs from expected one. |
| ModelIdInconsistent | Thrown when external and internal ids of model differ. |
| DeckIdInconsistent | Thrown when external and internal ids of deck differ. |
| DeckOptionsIdInconsistent | Thrown when external and internal ids of deck options differ. |
Instances
newtype WeaklyTypedInt Source #
A wrapper to handle integers and strings with integers.
Constructors
| WeaklyTypedInt | |
newtype WeaklyTypedBool Source #
A wrapper to handle booleans, strings with booleans and 0-1 integers.
Constructors
| WeaklyTypedBool | |
Instances
newtype ModificationTime Source #
A wrapper handle time in POSIX format.
Constructors
| ModificationTime | |
Fields | |
getTextValue :: Field -> Ok ByteString Source #
Read field as a byte sequence.
fromDictionary :: Typeable a => (Field -> (Text, Value) -> Ok a) -> Field -> Value -> Ok [a] Source #
Transform a JSON-dictionary to a list of values.
mkEntry :: (Typeable a, FromJSON a, Eq b, Typeable b, FromJSON b) => (a -> b) -> AnkiException -> Field -> (Text, Value) -> Ok a Source #
dropPrefixOptions :: Options Source #
Default options used in Aeson typeclasses in this module.