haskell,theorem-proving,dependent-type,higher-rank-types

I'm reading it as "given a term which requires l ~ r, return that term" It's "given a term whose type contains l, return that term with all ls being substituted by rs in the type" (or in the other direction r -> l). It's a very neat trick,...

gadt,higher-rank-types,purescript

The syntax used for existential types in Haskell is not present in PureScript. What you've written for Cons is a data constructor with a single universally-quantified argument. You might like to try using purescript-exists to encode the existential type instead. Another option is to use a final-tagless encoding of the...

haskell,polymorphism,higher-rank-types,polykinds

f2 requires its argument to be polymorphic in the kind k, while f1 is just polymorphic in the kind itself. So if you define {-# LANGUAGE RankNTypes, PolyKinds #-} f1 = undefined :: (forall a m. m a -> Int) -> Int f2 = undefined :: (forall (a :: k)...

While I'd prefer the solution @Oleg posted, I'd like to share an alternative. Replace main = print . g $ block [copy 10 1] with main = print (g (block [copy 10 1])) Reason: impredicative types make it hard for the compiler to guess the type of (.) and ($)...

haskell,lens,higher-rank-types

You want [bar] to have type [forall c . Lens' (Foo c) c], but it actually has the type forall f c . Functor f => [(c -> f c) -> Foo c -> f (Foo c)]. The compiler infers the latter type signature because it is predicative. You can...