Last active
June 3, 2018 23:21
-
-
Save paraseba/305247df3b287886635f4efb8ff32215 to your computer and use it in GitHub Desktop.
How to refer to a type variable hidden under an alias?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TupleSections #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
type Lens s t a b = | |
forall f. | |
Functor f => | |
(a -> f b) | |
-> s | |
-> f t | |
one :: forall a b x. Lens (a, x) (b, x) a b | |
one f (a, x) = (, x) <$> fa | |
where | |
-- This is the problematic line, if I delete the type signature everything works | |
-- But how should I write a type signature for this? | |
fa :: f b --- it complains about f1 b /= f b | |
fa = f a | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment