I've tried toying around with TypeApplications
, and used the following:
join = (>>= id)
:t join
join :: Monad m => m (m a) -> m a
:t join @[]
But I get the following error:
<interactive>:1:1: error:
* Cannot apply expression of type `m0 (m0 b0) -> m0 b0'
to a visible type argument `[]'
* In the expression: join @[]
This, in my view, should work, as
:t fmap @[]
fmap @[] :: (a -> b) -> [a] -> [b]
works.
Type applications only work for definitions that have explicit type signatures.
>>> join :: (Monad m) => m (m a) -> m a; join = (>>= id)
>>> :t join @[]
join @[] :: [[a]] -> [a]
All the gory details (and there are quite a few) of this extension are in the paper Visible Type Application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With