Created
July 17, 2016 08:17
-
-
Save isovector/48497057a45d8a68cdf220fb45798ce9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| runStoryApp :: Comonad w => StoryApp a -> CoStoryAppT w b -> (a, b) | |
| runStoryApp = pairEffect (,) | |
| runStory :: Comonad w => Story a -> CoStoryT w b -> (a, b) | |
| runStory = pairEffect (,) | |
| mkCoStoryApp :: Comonad w | |
| => w b | |
| -> (w b -> Character -> ChangeType -> w b) | |
| -> (forall x y . (forall a. Story a -> b) | |
| -> w b | |
| -> StoryApp x | |
| -> StoryApp y | |
| -> w b) | |
| -> (w b -> w b) | |
| -> CoStoryAppT w b | |
| mkCoStoryApp start changeH interruptH macguffinH = | |
| fix $ flip coiterT start . next . flip runStoryApp | |
| where | |
| next run w = | |
| CoStoryF | |
| (changeH w) | |
| (interruptH (unsafeCoerce run) w) | |
| (macguffinH w) | |
| mkCoStory :: Comonad w | |
| => w b | |
| -> (w b -> Character -> ChangeType -> (ChangeResult, w b)) | |
| -> (forall x y . (forall a. Story a -> (a, b)) | |
| -> w b | |
| -> Story x | |
| -> Story y | |
| -> (y, w b)) | |
| -> (w b -> (Desirable, w b)) | |
| -> CoStoryT w b | |
| mkCoStory start changeH interruptH macguffinH = | |
| fix $ flip coiterT start . next . flip runStory | |
| where | |
| next run w = | |
| CoStoryF | |
| (changeH w) | |
| (interruptH (unsafeCoerce run) w) | |
| (macguffinH w) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment