1{-# LANGUAGE DeriveDataTypeable #-}
3module Idris.Error where
5import Prelude hiding (catch)
11import Idris.Core.Typecheck
12import Idris.Core.Constraints
14import System.Console.Haskeline
15import System.Console.Haskeline.MonadException
16import Control.Monad.State.Strict
17import Control.Monad.Error (throwError, catchError)
18import System.IO.Error(isUserError, ioeGetErrorString)
23iucheck = do tit <- typeInType
26 (tclift $ ucheck (idris_constraints ist)) `idrisCatch`
27 (\e -> do setErrSpan (getErrSpan e)
28 iputStrLn (pshow ist e))
30showErr :: Err -> Idris String
31showErr e = getIState >>= return . flip pshow e
34report :: IOError -> String
36 | isUserError e = ioeGetErrorString e
39idrisCatch :: Idris a -> (Err -> Idris a) -> Idris a
40idrisCatch = catchError
43setAndReport :: Err -> Idris ()
44setAndReport e = do ist <- getIState
46 At fc e -> do setErrSpan fc
47 iWarn fc $ pprintErr ist e
48 _ -> do setErrSpan (getErrSpan e)
49 iWarn emptyFC $ pprintErr ist e
50 where unwrap (ProofSearchFail e) = e -- remove bookkeeping constructor
53ifail :: String -> Idris a
54ifail = throwError . Msg
56ierror :: Err -> Idris a
59tclift :: TC a -> Idris a
60tclift (OK v) = return v
61tclift (Error err@(At fc e)) = do setErrSpan fc; throwError err
62tclift (Error err) = throwError err
64tctry :: TC a -> TC a -> Idris a
68 Error err -> tclift tc2
70getErrSpan :: Err -> FC
71getErrSpan (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