Guest User

Untitled

a guest
Jun 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. import qualified Data.Set.Monad as S
  2.  
  3. fix f init = until (\x -> x == f x) f init
  4. close rstar = fix (\s -> s `S.union` (rstar s))
  5. rstar g s = do { x <- s; (x, y) <- g; pure y }
  6. reachable g = close (rstar g)
  7.  
  8. -- g1 = S.fromList [(1, 2), (2, 3), (3, 1), (4, 1)]
  9. -- reachable g1 (S.singleton 1) == S.fromList [1, 2, 3]
Add Comment
Please, Sign In to add comment