on master help sign in
Expose a bit more about reporting Results and Regions
4c79dddEvan Czaplicki
src/Reporting/Region.hs+2−2
@@ -15,7 +15,7 @@ data Region =
15 { _start :: !Position
15 { _start :: !Position
16 , _end :: !Position
16 , _end :: !Position
17 }
17 }
18− deriving (Eq, Show)
18+ deriving (Eq, Ord)
19
19
20
20
21data Position =
21data Position =
@@ -23,7 +23,7 @@ data Position =
23 { _line :: !Int
23 { _line :: !Int
24 , _column :: !Int
24 , _column :: !Int
25 }
25 }
26− deriving (Eq, Show)
26+ deriving (Eq, Ord)
27
27
28
28
29merge :: Region -> Region -> Region
29merge :: Region -> Region -> Region
src/Reporting/Result.hs+7
@@ -1,10 +1,12 @@
1{-# OPTIONS_GHC -Wall #-}
1{-# OPTIONS_GHC -Wall #-}
2module Reporting.Result
2module Reporting.Result
3 ( Result(..)
3 ( Result(..)
4+ , Answer(..)
4 , ok
5 , ok
5 , throw
6 , throw
6 , accumulate
7 , accumulate
7 , warn
8 , warn
9+ , untracked
8 , from
10 , from
9 , mapError
11 , mapError
10 , format
12 , format
@@ -70,6 +72,11 @@ warn region warning a =
70-- EXTRACTION HELPERS
72-- EXTRACTION HELPERS
71
73
72
74
75+untracked :: (Monoid i) => Result () w e a -> Result i w e a
76+untracked (Result () warnings answer) =
77+ Result mempty warnings answer
78+
79+
73from :: (Monoid i) => (e -> e') -> Except [A.Located e] a -> Result i w e' a
80from :: (Monoid i) => (e -> e') -> Except [A.Located e] a -> Result i w e' a
74from f except =
81from f except =
75 case runExcept except of
82 case runExcept except of