1-----------------------------------------------------------------------------
4-- Copyright : (c) 2013-15 Phil Freeman, (c) 2014-15 Gary Burgess
5-- License : MIT (http://opensource.org/licenses/MIT)
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
13-----------------------------------------------------------------------------
15{-# LANGUAGE TemplateHaskell #-}
22import qualified Data.Aeson.TH as A
24import qualified Language.PureScript as P
26data ErrorPosition = ErrorPosition
33data JSONError = JSONError
34 { position :: Maybe ErrorPosition
38 , filename :: Maybe String
39 , moduleName :: Maybe String
42data JSONResult = JSONResult
43 { warnings :: [JSONError]
44 , errors :: [JSONError]
47$(A.deriveJSON A.defaultOptions ''ErrorPosition)
48$(A.deriveJSON A.defaultOptions ''JSONError)
49$(A.deriveJSON A.defaultOptions ''JSONResult)
51toJSONErrors :: Bool -> P.Level -> P.MultipleErrors -> [JSONError]
52toJSONErrors verbose level = map (toJSONError verbose level) . P.runMultipleErrors
54toJSONError :: Bool -> P.Level -> P.ErrorMessage -> JSONError
55toJSONError verbose level e =
56 JSONError (toErrorPosition <$> sspan)
57 (P.renderBox (P.prettyPrintSingleError verbose level False (P.stripModuleAndSpan e)))
60 (P.spanName <$> sspan)
61 (P.runModuleName <$> P.errorModule e)
63 sspan :: Maybe P.SourceSpan
66 toErrorPosition :: P.SourceSpan -> ErrorPosition
68 ErrorPosition (P.sourcePosLine (P.spanStart ss))
69 (P.sourcePosColumn (P.spanStart ss))
70 (P.sourcePosLine (P.spanEnd ss))
71 (P.sourcePosColumn (P.spanEnd ss))
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