Hi!

> I'm afraid I didn't understand your questions well enough to answer them.

My question is, why does this type check:

instance Neuron TestNeuron where
  data LiveNeuron TestNeuron = LiveTestNeuron NeuronId

  mkLiveNeuron nid = LiveTestNeuron nid
  getNeuronId (LiveTestNeuron nid) = nid

  live _ _ = return ()

  attach nerve = ((liftM mkLiveNeuron) . forkIO $ bracket (grow :: IO
FooNeuron) dissolve (live nerve)) :: IO (LiveNeuron TestNeuron)

FooNeuron is obviously different to TestNeuron (but both are instances
of Neuron class).

Type signature is:

attach nerve = ((liftM mkLiveNeuron) . forkIO $ bracket (grow :: IO n)
dissolve (live nerve)) :: IO (LiveNeuron n)

This seems different to:

attach nerve = ((liftM mkLiveNeuron) . forkIO $ bracket (grow ::
forall n. IO n) dissolve (live nerve)) :: IO (LiveNeuron n)

which does not type check.

Maybe I am missing some basic understanding.

> But it'd be worth reading 
> http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/other-type-extensions.html#scoped-type-variables

I had. Thanks.


Mitar
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to