summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2019-06-25 16:35:40 -0400
committerJoe Crayne <joe@jerkface.net>2019-06-30 21:18:50 -0400
commit26af6c505812c9749f5e972d38fc8b771fab5de6 (patch)
treeda7d75afa6dc64374844780205ec8ff7afb323a8
parent462a8b8f9b44a80ff7f44b13716f1beea5a92698 (diff)
whitespace/documentation fixes
-rw-r--r--lib/FunctorToMaybe.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/FunctorToMaybe.hs b/lib/FunctorToMaybe.hs
index 658b024..b43a27a 100644
--- a/lib/FunctorToMaybe.hs
+++ b/lib/FunctorToMaybe.hs
@@ -7,12 +7,12 @@
7-- 7--
8-- Motivation: When parsing a stream of events, it is often desirable to 8-- Motivation: When parsing a stream of events, it is often desirable to
9-- let certain control events pass-through to the output stream without 9-- let certain control events pass-through to the output stream without
10-- interrupting the parse. For example, the conduit package uses 10-- interrupting the parse. For example, the conduit package uses
11-- <http://hackage.haskell.org/package/conduit-1.0.13.1/docs/Data-Conduit.html#t:Flush Flush> 11-- <http://hackage.haskell.org/package/conduit-1.0.13.1/docs/Data-Conduit.html#t:Flush Flush>
12-- which adds a special command to a stream and the blaze-builder-conduit 12-- which adds a special command to a stream and the blaze-builder-conduit
13-- package has <http://hackage.haskell.org/package/blaze-builder-conduit-1.0.0/docs/Data-Conduit-Blaze.html#g:2 conduits> that treat the nullary constructor with special significance. 13-- package has <http://hackage.haskell.org/package/blaze-builder-conduit-1.0.0/docs/Data-Conduit-Blaze.html#g:2 conduits> that treat the nullary constructor with special significance.
14-- 14--
15-- But for other intermediary conduits, the nullary @Flush@ constructor may 15-- But for other intermediary conduits, the nullary @Flush@ constructor may
16-- be noise that they should politely preserve in case it is meaningul downstream. 16-- be noise that they should politely preserve in case it is meaningul downstream.
17-- If <http://hackage.haskell.org/package/conduit-1.0.13.1/docs/Data-Conduit.html#t:Flush Flush> 17-- If <http://hackage.haskell.org/package/conduit-1.0.13.1/docs/Data-Conduit.html#t:Flush Flush>
18-- implemented the 'FunctorToMaybe' type class, then 'functorToEither' could be used to 18-- implemented the 'FunctorToMaybe' type class, then 'functorToEither' could be used to
@@ -27,7 +27,7 @@ import Control.Monad.Instances()
27#endif 27#endif
28 28
29-- | The 'FunctorToMaybe' class genaralizes 'Maybe' in that the 29-- | The 'FunctorToMaybe' class genaralizes 'Maybe' in that the
30-- there may be multiple null elements. 30-- there may be multiple null elements.
31-- 31--
32-- Instances of 'FunctorToMaybe' should satisfy the following laws: 32-- Instances of 'FunctorToMaybe' should satisfy the following laws:
33-- 33--
@@ -43,7 +43,6 @@ instance FunctorToMaybe (Either a) where
43 functorToMaybe (Right x) = Just x 43 functorToMaybe (Right x) = Just x
44 functorToMaybe _ = Nothing 44 functorToMaybe _ = Nothing
45 45
46
47-- | 'functorToEither' is a null-preserving cast. 46-- | 'functorToEither' is a null-preserving cast.
48-- 47--
49-- If @functorToMaybe g == Nothing@, then a casted value is returned with Left. 48-- If @functorToMaybe g == Nothing@, then a casted value is returned with Left.
@@ -52,12 +51,12 @@ instance FunctorToMaybe (Either a) where
52-- Returning to our <http://hackage.haskell.org/package/conduit-1.0.13.1/docs/Data-Conduit.html#t:Flush Flush> 51-- Returning to our <http://hackage.haskell.org/package/conduit-1.0.13.1/docs/Data-Conduit.html#t:Flush Flush>
53-- example, if we define 52-- example, if we define
54-- 53--
55-- > instance Flush where 54-- > instance FunctorToMaybe Flush where
56-- > functorToMaybe Flush = Nothing 55-- > functorToMaybe Flush = Nothing
57-- > functorToMaybe (Chunk a) = Just a 56-- > functorToMaybe (Chunk a) = Just a
58-- 57--
59-- Now stream processors can use 'functorToEither' to transform any nullary constructors while 58-- Now stream processors can use 'functorToEither' to transform any nullary constructors while
60-- while doing its work to transform the data before forwarding it into 59-- while doing its work to transform the data before forwarding it into
61-- <http://hackage.haskell.org/package/blaze-builder-conduit-1.0.0/docs/Data-Conduit-Blaze.html#v:builderToByteStringFlush builderToByteStringFlush>. 60-- <http://hackage.haskell.org/package/blaze-builder-conduit-1.0.0/docs/Data-Conduit-Blaze.html#v:builderToByteStringFlush builderToByteStringFlush>.
62-- 61--
63functorToEither :: FunctorToMaybe f => f a -> Either (f b) a 62functorToEither :: FunctorToMaybe f => f a -> Either (f b) a