Acquiring video with Purescript

I need to use navigator.mediaDevices.getUserMedia and trying to wrap in Purescript. I found https://github.com/puffnfresh/purescript-webrtc, but it’s for an old version of Purescript.

I’m trying to update it here: https://gist.github.com/tbenst/853eb5c017d2e0b00ce11b0716d651da. I figure that I should replace :: * with :: Type, and I’m guessing :: ! is :: Effect but don’t actually know.

Now I get a compile error on createObjectURL:

Error found:
at src/MediaStream.purs:44:1 - 44:2 (line 44, column 1 - line 44, column 2)

  Unable to parse module:
  Unexpected token ','

Any ideas? thanks!

Edit: fixed links

1 Like

! was the kind for effect indexing. In older versions of PS Effect was a kind, and Eff was the effect type indexed by things of kind Effect. Aff was similarly indexed in this way, but that was dropped during the transition to purescript-effect. It looks like the particular file you are linking to in the gist is just copy-paste duplication though, as it has the old file mixed in with the new, making invalid syntax.

Thanks, natefaubion, I appreciate the context and indeed it is currently invalid. Are you aware of any migration resources (documentation, posts, or code tools?). I can’t yet recognize old vs new syntax by eye…