I am trying to compile this small piece of code.
module Sodium where
import Prelude
import Control.Monad.Free
import Data.Coyoneda
import Data.Tuple
data ReactiveF more
= RFNewEvent (forall a. (Tuple (Event a) (a -> Reactive Unit) -> more))
type Reactive a = FreeC ReactiveF a
data Event a = Event a
newEvent :: forall a. Reactive (Tuple (Event a) (a -> Reactive Unit))
newEvent = liftFC $ RFNewEvent id
If instead of "a" in RFNewEvent instead of "a" instead of "a", everything compiles fine. But as soon as I go "forever." and replace "Number" with "a", it no longer compiles.
The following error message appears
Cannot unify type
a1
with type
a0
Does anyone know how to make this work?
I am using version 0.5.0 for purescript-free.
Edit
If I use the following
data NewEventData = NewEventData forall a. Tuple (Event a) (a -> Reactive Unit)
and replace it with RFNewEvent, then it will compile. But in the end, I get an invalid type signature for newEvent.
newEvent :: Reactive NewEventData
newEvent = liftFC $ RFNewEvent id
Allows me to create an event, but allows me to strip different values of events into the event stream instead of the same type. (missing forall a. now on newEvent)
I could be wrong.
SodiumFRP Free Monad. JavaScript FRP, Sodium FFI Free Monad.
?