~ubuntu-branches/ubuntu/raring/agda/raring-proposed

« back to all changes in this revision

Viewing changes to src/full/Agda/Interaction/Monad.hs

  • Committer: Bazaar Package Importer
  • Author(s): Iain Lane
  • Date: 2010-01-05 23:43:20 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100105234320-6ksc0sdsfhtweknu
Tags: 2.2.6-1
* New upstream release 2.2.6, for headlines please see:
  http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.Version-2-2-6
* debian/control
  + Bump standards-version to 3.8.3, no changes
  + Fix Vcs-Git to point to correct URL
  + Update build-depends for new upstream release
  + Undo arch/indep split per current pkg-haskell practice
  + Add Homepage field
* debian/copyright: Fix encoding to UTF-8 (thanks Lintian) 
* debian/README.source: Remove, no repacking so not necessary any more 
* debian/50agda.el:
  + Only load file if it exists, prevents a non-intrusive emacs warning
    where 50agda.el is left on system when package is removed. 
    (Closes: #559197). 
  + Do not load file on XEmacs — agda-mode is not compatible with XEmacs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
 
1
{-# LANGUAGE TypeSynonymInstances, MultiParamTypeClasses #-}
2
2
module Agda.Interaction.Monad where
3
3
 
4
4
import Agda.TypeChecking.Monad
5
5
 
6
6
import Control.Monad.Trans
 
7
import Control.Monad.Error
7
8
import System.Console.Haskeline
8
9
 
9
10
-- | Interaction monad.
10
11
 
11
12
type IM = TCMT (InputT IO)
12
13
 
 
14
instance MonadError TCErr IM where
 
15
  throwError = liftIO . throwIO
 
16
  catchError m h = mapTCMT liftIO $ runIM m `catchError` (runIM . h)
 
17
 
13
18
-- | Line reader. The line reader history is not stored between
14
19
-- sessions.
15
20
 
16
21
readline :: String -> IM (Maybe String)
17
22
readline s = lift (getInputLine s)
18
23
 
19
 
{-
20
 
data CurrentPoint = InInteractionPoint InteractionId | TopLevel
21
 
 
22
 
newtype IM a = IM {unIM :: StateT [CurrentPoint] TCM a}
23
 
   deriving (Monad,MonadIO)
24
 
 
25
 
 
26
 
instance MonadError e IM where
27
 
    throwError     = lift . throwError
28
 
    catchError m h = IM $ catchError (unIM m) (unIM . h)
29
 
 
30
 
 
31
 
 
32
 
instance MonadUndo [CurrentPoint] IM where
33
 
    undo =
34
 
 
35
 
 
36
 
run
37
 
 
38
 
-}
39
 
 
40
 
 
41
24
runIM :: IM a -> TCM a
42
25
runIM = mapTCMT (runInputT defaultSettings)