We want:
- interleaving effects
- constant space/time
- strong compasability/reusability
- We could try the List, but it doesn’t allow effects
- We could interleave effects via monads (mapM etc), but no constant space/time then and/or lazy IO, meh
We want:
-- | Some exercising for http://okmij.org/ftp/Computation/having-effect.html | |
module Main where | |
import Control.Monad.Eff.Console | |
import Control.Bind (bind) | |
import Data.Boolean (otherwise) | |
import Data.Eq ((==)) | |
import Data.Semigroup ((<>)) |
I recently read this interesting post about eventual values. One thing that struck me and which I failed to understand is:
- Eventual Values can be interacted with like normal values.
- If an Eventual Value is part of a simple value operation, then that expression resolves to a new Eventual > Value which resolves when all its Eventual Values are resolved.
If I understood the author correctly, that is supposed to be solving several problems:
I hereby claim:
To claim this, I am signing this object:
-- | https://jeltsch.wordpress.com/2013/02/14/the-constraint-kind/ | |
{-# LANGUAGE ConstraintKinds, TypeFamilies #-} | |
import Prelude hiding (Functor(..)) | |
import Data.Set (Set) | |
import qualified Data.Set as Set | |
import GHC.Exts (Constraint) | |
class Functor f where | |
type Object f a :: Constraint |
Cycle.js approach to handling IO looks similar to how it was done in earlier FRP implementations. That seems to be an independent discovery, and that's always even better.
Yampa provides a function reactimate
:
:: IO a -- ^ IO initialization action
-> (Bool -> IO (DTime, Maybe a)) -- ^ IO input sensing action
-> (Bool -> b -> IO Bool) -- ^ IO actuaction (output processing) action
-> SF a b -- ^ Signal function
module MiniSodium where | |
import Prelude | |
import Data.Maybe | |
import Control.Apply | |
import Control.Bind | |
data Stream m a = Stream { sample :: m (Maybe a) } | |
runStream (Stream s) = s |
package aurelienribon.bodyeditor; | |
import com.badlogic.gdx.files.FileHandle; | |
import com.badlogic.gdx.math.Vector2; | |
import com.badlogic.gdx.physics.box2d.Body; | |
import com.badlogic.gdx.physics.box2d.CircleShape; | |
import com.badlogic.gdx.physics.box2d.FixtureDef; | |
import com.badlogic.gdx.physics.box2d.PolygonShape; | |
import com.badlogic.gdx.utils.Array; | |
import com.badlogic.gdx.utils.JsonReader; |
import static com.googlecode.javacv.cpp.opencv_core.cvCopy; | |
import static com.googlecode.javacv.cpp.opencv_core.cvCreateImage; | |
import static com.googlecode.javacv.cpp.opencv_core.cvGetSize; | |
import static com.googlecode.javacv.cpp.opencv_core.cvSetImageROI; | |
import static com.googlecode.javacv.cpp.opencv_highgui.cvLoadImage; | |
import static com.googlecode.javacv.cpp.opencv_highgui.cvSaveImage; | |
import com.googlecode.javacv.cpp.opencv_core.CvRect; | |
import com.googlecode.javacv.cpp.opencv_core.IplImage; |