1{-# LANGUAGE DeriveDataTypeable #-}
3module Idris.Error where
5import Prelude hiding (catch)
11import Core.Constraints
13import System.Console.Haskeline
14import System.Console.Haskeline.MonadException
15import Control.Monad.State
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 setErrLine (getErrLine 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
41setAndReport :: Err -> Idris ()
42setAndReport e = do ist <- getIState
43 let h = idris_outh ist
45 At fc@(FC f l c) e -> do setErrLine l
46 ihWarn h fc $ pshow ist e
47 _ -> do setErrLine (getErrLine e)
48 ihputStrLn h $ pshow ist e
50ifail :: String -> Idris a
51ifail = throwError . Msg
53ierror :: Err -> Idris a
56tclift :: TC a -> Idris a
57tclift (OK v) = return v
58tclift (Error err@(At (FC f l c) e)) = do setErrLine l ; throwError err
59tclift (Error err) = throwError err
61tctry :: TC a -> TC a -> Idris a
65 Error err -> tclift tc2
67getErrLine :: Err -> Int
68getErrLine (At (FC _ l _) _) = l
71getErrColumn :: Err -> Int
72getErrColumn (At (FC _ _ c) _) = c
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