This file is indexed.

/usr/share/doc/libghc-operational-doc/html/operational.txt is in libghc-operational-doc 0.2.3.2-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Implementation of difficult monads made easy
--   with operational semantics.
--   
--   This library makes it easy to implement monads with tricky control
--   flow.
--   
--   This is useful for: writing web applications in a sequential style,
--   programming games with a uniform interface for human and AI players
--   and easy replay capababilities, implementing fast parser monads,
--   designing monadic DSLs, etc.
--   
--   See the project homepage
--   <a>http://haskell.org/haskellwiki/Operational</a> for a more detailed
--   introduction and features.
--   
--   Related packages: MonadPrompt
--   <a>http://hackage.haskell.org/package/MonadPrompt</a>.
@package operational
@version 0.2.3.2

module Control.Monad.Operational

-- | The abstract data type <tt><a>Program</a> instr a</tt> represents
--   programs, i.e. sequences of primitive instructions.
--   
--   <ul>
--   <li>The <i>primitive instructions</i> are given by the type
--   constructor <tt>instr :: * -&gt; *</tt>.</li>
--   <li><tt>a</tt> is the return type of a program.</li>
--   </ul>
--   
--   <tt><a>Program</a> instr</tt> is always a monad and automatically
--   obeys the monad laws.
type Program instr = ProgramT instr Identity

-- | Program made from a single primitive instruction.
singleton :: instr a -> ProgramT instr m a

-- | View type for inspecting the first instruction. It has two
--   constructors <a>Return</a> and <tt>:&gt;&gt;=</tt>. (For technical
--   reasons, they are documented at <a>ProgramViewT</a>.)
type ProgramView instr = ProgramViewT instr Identity

-- | View function for inspecting the first instruction.
view :: Program instr a -> ProgramView instr a

-- | Utility function that extends a given interpretation of instructions
--   as monadic actions to an interpration of <a>Program</a>s as monadic
--   actions.
--   
--   This function can be useful if you are mainly interested in mapping a
--   <a>Program</a> to different standard monads, like the state monad. For
--   implementing a truly custom monad, you should write your interpreter
--   directly with <a>view</a> instead.
interpretWithMonad :: Monad m => (forall a. instr a -> m a) -> (Program instr b -> m b)

-- | The abstract data type <tt><a>ProgramT</a> instr m a</tt> represents
--   programs over a base monad <tt>m</tt>, i.e. sequences of primitive
--   instructions and actions from the base monad.
--   
--   <ul>
--   <li>The <i>primitive instructions</i> are given by the type
--   constructor <tt>instr :: * -&gt; *</tt>.</li>
--   <li><tt>m</tt> is the base monad, embedded with <a>lift</a>.</li>
--   <li><tt>a</tt> is the return type of a program.</li>
--   </ul>
--   
--   <tt><a>ProgramT</a> instr m</tt> is a monad transformer and
--   automatically obeys both the monad and the lifting laws.
data ProgramT instr m a

-- | View type for inspecting the first instruction. This is very similar
--   to pattern matching on lists.
--   
--   <ul>
--   <li>The case <tt>(Return a)</tt> means that the program contains no
--   instructions and just returns the result <tt>a</tt>.</li>
--   <li>The case <tt>(someInstruction :&gt;&gt;= k)</tt> means that the
--   first instruction is <tt>someInstruction</tt> and the remaining
--   program is given by the function <tt>k</tt>.</li>
--   </ul>
data ProgramViewT instr m a
Return :: a -> ProgramViewT instr m a
(:>>=) :: instr b -> (b -> ProgramT instr m a) -> ProgramViewT instr m a

-- | View function for inspecting the first instruction.
viewT :: Monad m => ProgramT instr m a -> m (ProgramViewT instr m a)

-- | Lift a plain sequence of instructions to a sequence of instructions
--   over a monad <tt>m</tt>. This is the counterpart of the <a>lift</a>
--   function from <a>MonadTrans</a>.
--   
--   It can be defined as follows:
--   
--   <pre>
--   liftProgram = eval . view
--       where
--       eval :: ProgramView instr a -&gt; ProgramT instr m a
--       eval (Return a) = return a
--       eval (i :&gt;&gt;= k) = singleton i &gt;&gt;= liftProgram . k
--   </pre>
liftProgram :: Monad m => Program instr a -> ProgramT instr m a
instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Operational.ProgramT instr m)
instance Control.Monad.Trans.Class.MonadTrans (Control.Monad.Operational.ProgramT instr)
instance GHC.Base.Monad m => GHC.Base.Functor (Control.Monad.Operational.ProgramT instr m)
instance GHC.Base.Monad m => GHC.Base.Applicative (Control.Monad.Operational.ProgramT instr m)
instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (Control.Monad.Operational.ProgramT instr m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Monad.Operational.ProgramT instr m)
instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Control.Monad.Operational.ProgramT instr m)