Skip to content

Commit

Permalink
upgrades for GHC 7.4.1 and doc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jberryman committed Jul 4, 2012
1 parent 10539b4 commit ca2c938
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
13 changes: 6 additions & 7 deletions Control/Concurrent/Actors.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ This module exports a simple, idiomatic implementation of the Actor Model.
> {- |
> The 'spawn' function will be sufficient for forking actors in most cases,
> but launching mutually-communicating actors presents a problem.
> .
>
> In cases where a 'Behavior' needs access to its own 'Mailbox' or that of
> an actor that must be forked later, the 'MonadFix' instance should be
> used. GHC\'s \"Recursive Do\" make this especially easy:
> .
>
> > {-# LANGUAGE DoRec #-}
> > beh = Receive $ do
> > i <- received
Expand All @@ -122,7 +122,9 @@ This module exports a simple, idiomatic implementation of the Actor Model.
> > send b3 i
> > send "first" b2
> > yield
>
> -}
>
> , spawn
> , spawn_
> , spawnReading
Expand Down Expand Up @@ -197,9 +199,6 @@ work with GHCi:

TODO
-----
0.2.0
- update for newest packages and haskell platform

0.3.0:
- define natural transformation combinators (in IO unfortunately) a.la.
'categories' for Mailbox. So
Expand Down Expand Up @@ -411,7 +410,7 @@ USEFUL GENERAL BEHAVIORS

> -- | Prints all messages to STDOUT in the order they are received,
> -- 'yield'-ing /immediately/ after @n@ inputs are printed.
> printB :: (Show s, Num n)=> n -> Behavior s
> printB :: (Show s, Eq n, Num n)=> n -> Behavior s
> printB = contramap (unlines . return . show) . putStrB

We want to yield right after printing the last input to print. This lets us
Expand All @@ -426,7 +425,7 @@ happen as soon as the sixth message was received.
For now we allow negative

> -- | Like 'printB' but using @putStr@.
> putStrB :: (Num n)=> n -> Behavior String
> putStrB :: (Eq n, Num n)=> n -> Behavior String
> putStrB 0 = mempty --special case when called directly w/ 0
> putStrB n = Receive $ do
> s <- received
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# What's this all about?

`simple-actors` is a haskell eDSL for writing highly-structured concurrent
programs based on the so-called
[Actor Model](http://en.wikipedia.org/wiki/Actor_model). It provides a far
more structured way of organizing concurrent code than ad-hoc use of `Chan`,
`forkIO` and `MVar`s.

The library was designed to make easy to implement message-passing algorithms
and the like, but as I work on it and learn more about distributed computing,
I'm hoping it can be used across the network eventually.

# How do I do it?

Install with a

cabal install simple-actors

and check out the docs [here](http://hackage.haskell.org/package/simple-actors).
8 changes: 7 additions & 1 deletion simple-actors.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Name: simple-actors
-- The package version. See the Haskell package versioning policy
-- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for
-- standards guiding when and how versions should be incremented.
Version: 0.1.0
Version: 0.2.0

-- A short (one-line) description of the package.
Synopsis: A library for more structured concurrent programming, based
Expand All @@ -20,6 +20,12 @@ Description: simple-actors is an EDSL-style library for writing
Model. Computations are structured as "Behaviors" which take a
single input value, perform some 'Action's, and return the
Behavior to process the next input message it receives.
.
/CHANGES/ 0.1 - 0.2:
.
- documentation cleanup
.
- updates for GHC 7.4.1

-- The license under which the package is released.
License: BSD3
Expand Down

0 comments on commit ca2c938

Please sign in to comment.