Sophie

Sophie

distrib > Fedora > 19 > i386 > by-pkgid > 6141746cd5048a6ddf1cf3194274ce61 > files > 1261

ghc-Agda-devel-2.3.2.1-5.fc19.i686.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/full/Agda/Packaging/Monad.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>{-# LANGUAGE GeneralizedNewtypeDeriving #-}</span>
<a name="line-2"></a>
<a name="line-3"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>Agda</span><span class='hs-varop'>.</span><span class='hs-conid'>Packaging</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span> <span class='hs-keyword'>where</span>
<a name="line-4"></a>
<a name="line-5"></a><span class='hs-comment'>{-
<a name="line-6"></a>  ( module Control.Monad.Reader
<a name="line-7"></a>  , AgdaPkg (..)
<a name="line-8"></a>  , asksM ) where
<a name="line-9"></a>
<a name="line-10"></a>-- Standard Library Imports
<a name="line-11"></a>import Control.Applicative
<a name="line-12"></a>import Control.Monad.Error
<a name="line-13"></a>import Control.Monad.Reader
<a name="line-14"></a>
<a name="line-15"></a>-- Local Imports
<a name="line-16"></a>import Agda.Packaging.Config
<a name="line-17"></a>
<a name="line-18"></a>--------------------------------------------------------------------------------
<a name="line-19"></a>
<a name="line-20"></a>-- Parametric in `opt' only so that the environment can be decoupled
<a name="line-21"></a>-- from the concrete CLI tool
<a name="line-22"></a>newtype AgdaPkg opt a
<a name="line-23"></a>  =     AgdaPkg
<a name="line-24"></a>  { runAgdaPkg :: ReaderT (AgdaPkgConfig opt) IO a }
<a name="line-25"></a>  deriving
<a name="line-26"></a>    ( Functor
<a name="line-27"></a>    , Monad
<a name="line-28"></a>    , MonadError IOError
<a name="line-29"></a>    , MonadReader (AgdaPkgConfig opt)
<a name="line-30"></a>    , MonadIO )
<a name="line-31"></a>
<a name="line-32"></a>instance Applicative (AgdaPkg opt) where
<a name="line-33"></a>  pure  = return
<a name="line-34"></a>  (&lt;*&gt;) = ap
<a name="line-35"></a>
<a name="line-36"></a>asksM :: (MonadReader r m) =&gt; (r -&gt; m a) -&gt; m a
<a name="line-37"></a>asksM = join . asks
<a name="line-38"></a>-}</span>
</pre></body>
</html>