Skip to content

Instantly share code, notes, and snippets.

@paraseba
Last active June 3, 2018 23:21
Show Gist options
  • Save paraseba/305247df3b287886635f4efb8ff32215 to your computer and use it in GitHub Desktop.
Save paraseba/305247df3b287886635f4efb8ff32215 to your computer and use it in GitHub Desktop.
How to refer to a type variable hidden under an alias?
{-# 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