File: Shared.hs

package info (click to toggle)
lambdabot 4.2.3.2-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 5,584 kB
  • sloc: haskell: 10,102; ansic: 76; makefile: 7
file content (28 lines) | stat: -rw-r--r-- 953 bytes parent folder | download
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
{-# LANGUAGE Rank2Types, TypeOperators #-}

-- Copyright (c) 2005 Don Stewart - http://www.cse.unsw.edu.au/~dons
-- GPL version 2 or later (see http://www.gnu.org/copyleft/gpl.html)

-- | Shared types between static and dynamic code. This is the only
-- module that is linked both statically and dynamically. (And doing so
-- breaks us from running the whole of the bot in ghci -- so sue me).

module Shared (Module(..), Symbol, DynLoad(..)) where

type Symbol = String

newtype Module = Module String {- unique module identifier -}

-- | Operations provided by the dynamic linker linked into the static
-- core. A DynLoad value is passed from there to the dynamic code, for
-- use by DynamicModule
--
-- Possibly want to treat this as an existential, ala MODULE
--
-- could add to DynLoad, Typeable a => ...
--
data DynLoad = DynLoad {
        dynload    :: forall a. FilePath -> Symbol -> IO (Module,a),
        unload     :: Module   -> IO ()
    }