hpage 0.3.0 → 0.3.1
raw patch · 2 files changed
+5/−79 lines, 2 filesdep +eprocess
Dependencies added: eprocess
Files
- hpage.cabal +5/−5
- src/Control/Concurrent/Process.hs +0/−74
hpage.cabal view
@@ -1,5 +1,5 @@ name: hpage-version: 0.3.0+version: 0.3.1 cabal-version: >=1.6 build-type: Custom license: BSD3@@ -11,7 +11,7 @@ package-url: http://code.haskell.org/hpage bug-reports: http://github.com/elbrujohalcon/hPage/issues synopsis: A scrapbook for Haskell developers-description: hPage is targeted at those haskell developers which also like to work with dynamic GUIs and wish to have something like Smalltalk's Workbook or jPage for Java. Using hPage developers can write haskell expressions, evaluate and test them, load, unload and (of course) reload modules and then, re-evaluate the same expressions (ghci anyone?). Developed over wxWidgets, hPage is multi-platform by nature and works in every scenario where ghc and wxWidgets work.+description: hPage is targeted at those haskell developers which also like to work with dynamic GUIs and wish to have something like Smalltalk's Workspace or jPage for Java. Using hPage developers can write haskell expressions, evaluate and test them, load, unload and (of course) reload modules and then, re-evaluate the same expressions (ghci anyone?). Developed over wxWidgets, hPage is multi-platform by nature and works in every scenario where ghc and wxWidgets work. category: Development, IDE, Editor author: Fernando "Brujo" Benavides tested-with: GHC ==6.10.3, GHC ==6.10.4@@ -45,7 +45,8 @@ wx >=0.11.1, wx < 0.12, filepath >=1.1.0, filepath < 1.2, Cabal >= 1.6, Cabal < 1.7,- MissingH >= 1.1, MissingH < 1.2+ MissingH >= 1.1, MissingH < 1.2,+ eprocess >= 1.0.0, eprocess < 2 main-is: Main.hs buildable: True build-tools:@@ -58,8 +59,7 @@ extensions: CPP install-includes: hs-source-dirs: src- other-modules: Control.Concurrent.Process,- HPage.GUI.IDs,+ other-modules: HPage.GUI.IDs, HPage.GUI.FreeTextWindow, HPage.GUI.Dialogs, HPage.Control,
− src/Control/Concurrent/Process.hs
@@ -1,74 +0,0 @@-{-# LANGUAGE GeneralizedNewtypeDeriving,- MultiParamTypeClasses,- FlexibleInstances,- FunctionalDependencies,- UndecidableInstances #-} --module Control.Concurrent.Process (- Handle, sendTo,- ReceiverT, recv, self,- sendRecv,- Process, makeProcess, runHere, spawn- ) where--import Control.Monad.Reader-import Control.Monad.State.Class-import Control.Monad.Writer.Class-import Control.Monad.Error.Class-import Control.Monad.CatchIO-import Data.Monoid-import Control.Concurrent-import Control.Concurrent.Chan--newtype Handle r = PH {chan :: Chan r}--newtype ReceiverT r m a = RT { internalReader :: ReaderT (Handle r) m a }- deriving (Monad, MonadIO, MonadTrans, MonadCatchIO)--type Process r = ReceiverT r IO--sendTo :: MonadIO m => Handle a -> a -> m ()-sendTo ph = liftIO . writeChan (chan ph)--recv :: MonadIO m => ReceiverT r m r-recv = RT $ ask >>= liftIO . readChan . chan--sendRecv :: MonadIO m => Handle a -> a -> ReceiverT r m r-sendRecv h a = sendTo h a >> recv --spawn :: MonadIO m => Process r k -> m (Handle r) -spawn p = liftIO $ do- pChan <- newChan- let handle = PH { chan = pChan }- let action = runReaderT (internalReader p) handle- forkIO $ action >> return ()- return handle--runHere :: MonadIO m => Process r t -> m t-runHere p = liftIO (runReaderT (internalReader p) . PH =<< newChan)--self :: Monad m => ReceiverT r m (Handle r)-self = RT ask--makeProcess :: (m t -> IO s) -> ReceiverT r m t -> Process r s -makeProcess f (RT a) = RT (mapReaderT f a)--instance MonadState s m => MonadState s (ReceiverT r m) where- get = lift get- put = lift . put--instance MonadReader r m => MonadReader r (ReceiverT r m) where- ask = lift ask- local = onInner . local --instance (Monoid w, MonadWriter w m) => MonadWriter w (ReceiverT w m) where- tell = lift . tell- listen = onInner listen- pass = onInner pass--instance MonadError e m => MonadError e (ReceiverT r m) where- throwError = lift . throwError- catchError (RT a) h = RT $ a `catchError` (\e -> internalReader $ h e)--onInner :: (m a -> m b) -> ReceiverT r m a -> ReceiverT r m b-onInner f (RT m) = RT $ mapReaderT f m