Skip to content

Instantly share code, notes, and snippets.

@eklitzke
Created June 27, 2009 23:02

Revisions

  1. eklitzke revised this gist Jun 27, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.hs
    Original file line number Diff line number Diff line change
    @@ -9,4 +9,4 @@ run :: Strategy s => s -> IO [Ports]
    run world = let loop = do w' = next world
    if isDone w'
    then fetch w'
    else loop in loop
    else loop w' in loop world
  2. eklitzke created this gist Jun 27, 2009.
    12 changes: 12 additions & 0 deletions gistfile1.hs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    class Strategy s where
    store :: s -> Ports -> IO ()
    fetch :: s -> IO [Ports]
    isDone :: Ports -> Bool
    updatePorts :: Ports -> IO Ports
    next :: s -> s

    run :: Strategy s => s -> IO [Ports]
    run world = let loop = do w' = next world
    if isDone w'
    then fetch w'
    else loop in loop