Skip to content

Instantly share code, notes, and snippets.

globalMonitor :: Process ()
globalMonitor = do
let initState = [] :: [MxEvent]
void $ mxAgent (MxAgentId "lifecycle-listener-agent") initState [
mxSink $ \ev -> do
let act =
case ev of
(MxProcessDied pid (DiedException msg)) -> liftMX $ say $ debug $ "[Error] " ++ show pid ++ " DiedException: " ++ msg
(MxProcessDied pid DiedDisconnect) -> liftMX $ say $ show pid ++ " DiedDisconnect"
@jeremyjh
jeremyjh / DeclareFields.hs
Created February 18, 2014 01:44
non-working example of declareFields
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE FlexibleInstances #-}
module Main where
import Control.Lens
declareFields [d|
@jeremyjh
jeremyjh / LiftedExample.hs
Created December 5, 2013 01:55
an example using Lifted Process primitives with a custom monad stack
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Control.Distributed.Process.Lifted
( module Control.Distributed.Process
, module Control.Distributed.Process.Lifted
)
where
import Control.Monad.Trans.Control
@jeremyjh
jeremyjh / NodeProcess.hs
Created December 5, 2013 01:24
example helpers to make cloud haskell easier in repl
-- Functions intended to make it easier to work with distributed-process
-- from the REPL.
module NodeProcess where
import Control.Distributed.Process
import Control.Distributed.Process.Serializable
import Control.Concurrent.MVar
import Control.Concurrent (threadDelay)
@jeremyjh
jeremyjh / ctags.rake
Created October 3, 2012 00:24
Rebuild CTAGS including only bundled gems and rails project files
desc "Regenerate tags (CTAGS)"
task :ctags do
puts " * Regenerating Tags"
excludes = %w{
.git
.git*
*.yml
app/views
app/assets
coverage