Commit graph

8 commits

Author SHA1 Message Date
Jesse Rosenthal
cc7191b3b1 Class: Add stateful IO warnings, and function to get warndings.
Right now, the io warnings both print to stderr and write to the
state. That can be easily modified.

We also add a getWarnings function which pulls warnings out of the state
for instances of PandocMonad.
2017-01-25 17:07:40 +01:00
John MacFarlane
300d94ac24 Deleted whitespace at end of source lines. 2017-01-25 17:07:39 +01:00
Jesse Rosenthal
23c5b0d0f1 Implement Errors in PandocMonad
Errors can be thrown purely with `throwError`. At the moment there are
only three kinds of errors:

1. PandocFileReadError FilePath (for problems reading a file from the
filesystem)

2. PandocShouldNeverHappenError String (for stuff that should never
happen but we need to pattern-match anyway)

3. PandocSomeError String (a grab bag of everything else)

Of course, we need to subdivide the third item in this list.
2017-01-25 17:07:39 +01:00
Jesse Rosenthal
b19f79f672 Add runPure function.
This requires a default environment. The state variables are pretty
straightforward. The env variables are a little trickier. I'm just
making most of them empty for now. Note that some of them (like
defaultReferenceDocx/ODT) will be coming out soon anyway.
2017-01-25 17:07:39 +01:00
Jesse Rosenthal
b2721c6b02 Make PandocExecutionError an exception
Until we fix fetchItem and fetchItem' to make use of MonadError, we have
to thow an exception. We'll throw PandocFileReadError. Note that this is
temporary.
2017-01-25 17:07:39 +01:00
Jesse Rosenthal
a94f3dddee Make opaque typeclasses PandocPure and PandocIO 2017-01-25 17:07:39 +01:00
Jesse Rosenthal
45f3c53dd9 Class: Specify Functor and Applicative
We're still compiling for 7.8 which is pre-AMP, so let's just be
explicit about it so we can use applicative notation.
2017-01-25 17:07:39 +01:00
Jesse Rosenthal
239880f412 Introduce PandocMonad typeclass.
This can be instantiated by both an IO monad or a pure State monad.
2017-01-25 17:07:39 +01:00