Closed walseb closed 4 years ago
I don't know about Yampa
, but if you use FRP.BearRiver, your
SFs have an extra argument
mwhich is the monad inside the
ClockInfo. You can use that to set it to
ListT m`.
Sorry, my problem was with not understanding monad transformers in general. Now that I have a better understanding of it, this is essentially my problem:
-- this works
intList :: (Monad m) => (ListT m) Int
intList = lift int
int :: (Monad m) => m Int
int = pure 7
-- This doesn't
objList :: (Monad m) => MSF (ListT m) () ()
objList = lift obj -- Error here
obj :: (Monad m) => MSF m () ()
obj = undefined
The error I get is:
• Couldn't match kind ‘*’ with ‘* -> *’
When matching types
t0 :: (* -> *) -> * -> *
MSF (ListT m) :: * -> * -> *
Expected type: MSF (ListT m) () ()
Actual type: t0 (MSF m0 ()) ()
Which to me seems like I'm using the wrong lift operator, because the kind signature doesn't seem to match. But I can't find the one used in the paper (liftS
) in https://hackage.haskell.org/package/dunai-0.7.0/docs/Control-Monad-Trans-MSF-List.html
Yes, it's really a wart that we don't have liftS
anymore. @ivanperez-keera Maybe it's possible to bring it back with a deprecation comment?
@walseb In your example, we're looking for something that lifts an MSF
along a monad morphism (lift
in this case), so something of type signature (forall x . m x -> n x) -> MSF m a b -> MSF n a b
. Hoogle finds the required function: https://hoogle.haskell.org/?hoogle=%28forall+a+.+m+a+-%3E+n+a%29+-%3E+MSF+m+a+b+-%3E+MSF+n+a+b&scope=package%3Adunai
It's morphS
.
Thanks! It works now!
Awesome! So is this issue resolved then?
Oh yeah I forgot to close it
Hi! So yampa has
ListSF
as discussed here. In bearriver/dunai, using the list monad transformer seems to be the way to go, but the example in "Functional Reactive Programming, Refactored" section 4.4 doesn't compile in dunai and I haven't been able to get a it workingThe main problem is that
liftS
doesn't seem to exist in dunai. For example in:I get the error:
Because the move MSF isn't lifted into ListT. How do I do this and is there anything else I need to think about? Also are there any bearriver projects using
ListT
or other monads likeEitherT
,Maybe
, etc.Thanks!