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
37 , filename :: Maybe String
38 , moduleName :: Maybe String
41data JSONResult = JSONResult
42 { warnings :: [JSONError]
43 , errors :: [JSONError]
46$(A.deriveJSON A.defaultOptions ''ErrorPosition)
47$(A.deriveJSON A.defaultOptions ''JSONError)
48$(A.deriveJSON A.defaultOptions ''JSONResult)
50toJSONErrors :: Bool -> P.Level -> P.MultipleErrors -> [JSONError]
51toJSONErrors verbose level = map (toJSONError verbose level) . P.runMultipleErrors
53toJSONError :: Bool -> P.Level -> P.ErrorMessage -> JSONError
54toJSONError verbose level e =
55 JSONError (toErrorPosition <$> sspan)
56 (P.renderBox (P.prettyPrintSingleError' verbose level (P.stripModuleAndSpan e)))
58 (P.spanName <$> sspan)
59 (P.runModuleName <$> P.errorModule e)
61 sspan :: Maybe P.SourceSpan
64 toErrorPosition :: P.SourceSpan -> ErrorPosition
66 ErrorPosition (P.sourcePosLine (P.spanStart ss))
67 (P.sourcePosColumn (P.spanStart ss))
68 (P.sourcePosLine (P.spanEnd ss))
69 (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