1{-# LANGUAGE DeriveDataTypeable #-}
3module Idris.Error where
5import Prelude hiding (catch)
10import Idris.Core.Typecheck
11import Idris.Core.Constraints
13import System.Console.Haskeline
14import System.Console.Haskeline.MonadException
15import Control.Monad.State.Strict
16import Control.Monad.Error (throwError, catchError)
17import System.IO.Error(isUserError, ioeGetErrorString)
22iucheck = do tit <- typeInType
25 (tclift $ ucheck (idris_constraints ist)) `idrisCatch`
26 (\e -> do setErrSpan (getErrSpan e)
27 iputStrLn (pshow ist e))
29showErr :: Err -> Idris String
30showErr e = getIState >>= return . flip pshow e
33report :: IOError -> String
35 | isUserError e = ioeGetErrorString e
38idrisCatch :: Idris a -> (Err -> Idris a) -> Idris a
39idrisCatch = catchError
42setAndReport :: Err -> Idris ()
43setAndReport e = do ist <- getIState
44 let h = idris_outh ist
46 At fc e -> do setErrSpan fc
47 ihWarn h fc $ pprintErr ist e
48 _ -> do setErrSpan (getErrSpan e)
49 ihputStrLn h $ pshow ist e
51ifail :: String -> Idris a
52ifail = throwError . Msg
54ierror :: Err -> Idris a
57tclift :: TC a -> Idris a
58tclift (OK v) = return v
59tclift (Error err@(At fc e)) = do setErrSpan fc; throwError err
60tclift (Error err) = throwError err
62tctry :: TC a -> TC a -> Idris a
66 Error err -> tclift tc2
68getErrSpan :: Err -> FC
69getErrSpan (At fc _) = fc
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