1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE Rank2Types #-}
14import qualified Data.OneOrMore as OneOrMore
15import qualified Reporting.Warning as Warning
22newtype Result info warnings error a =
27 -> (info -> warnings -> OneOrMore.OneOrMore error -> result)
28 -> (info -> warnings -> a -> result)
33run :: Result () [w] e a -> ([w], Either (OneOrMore.OneOrMore e) a)
36 (\() w e -> (reverse w, Left e))
37 (\() w a -> (reverse w, Right a))
44ok :: a -> Result i w e a
46 Result $ \i w _ good ->
50warn :: Warning.Warning -> Result i [Warning.Warning] e ()
52 Result $ \i warnings _ good ->
53 good i (warning:warnings) ()
56throw :: e -> Result i w e a
58 Result $ \i w bad _ ->
59 bad i w (OneOrMore.one e)
62mapError :: (e -> e') -> Result i w e a -> Result i w e' a
63mapError func (Result k) =
64 Result $ \i w bad good ->
67 bad i1 w1 (OneOrMore.map func e1)
73-- FANCY INSTANCE STUFF
76instance Functor (Result i w e) where
77 fmap func (Result k) =
78 Result $ \i w bad good ->
81 good i1 w1 (func value)
86instance Applicative (Result i w e) where
89 (<*>) (Result kf) (Result kv) =
90 Result $ \i w bad good ->
94 bad2 i2 w2 e2 = bad i2 w2 (OneOrMore.more e1 e2)
95 good2 i2 w2 _value = bad i2 w2 e1
101 bad2 i2 w2 e2 = bad i2 w2 e2
102 good2 i2 w2 value = good i2 w2 (func value)
109instance Monad (Result i w e) where
112 (>>=) (Result ka) callback =
113 Result $ \i w bad good ->
117 Result kb -> kb i1 w1 bad good
121 -- TODO PERF add more specialized definitions?
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list