Questions tagged [impredicativetypes]

A rarely-used GHC type system extension that allows quantifiers to appear anywhere in a type.

20 questions
2
votes
1 answer

Ways around impredictive polymorphism

I'm new to some of the more complicated type constructs in Haskell, and have been messing around. I'm currently stuck trying to get a function that I think should work to type check. Take the following code as an example: {-# LANGUAGE RankNTypes …
Neil Locketz
  • 3,736
  • 1
  • 22
  • 33
2
votes
1 answer

Disallow assignment of values

I'm experimenting with a type-level permission system, and I'm trying to disallow assignment of values which do not originate from the same "source", i.e: data A = A { a :: Value, b :: Value } modify :: A -> A modify (A v) = A $ v { a = v.a } --…
2
votes
1 answer

How to make impredicative types work with type classes

I was seeing what I could do with ImpredicativeTypes and wanted to see what exactly I could do with them. When I ran to what I feel is some strange behavior when it comes to their interaction with TypeClasses. :t mempty mempty :: forall a. Monoid a…
semicolon
  • 2,313
  • 20
  • 30
1
vote
2 answers

General 'typeless' STack in Haskell

I need to implement a general stack for something I'm working on. This stack should be able to hold elements of different types. For example, (1, 'c', True, "Strings"). The functions to be supported are top, pop and push. Tuples are the most natural…
1
vote
1 answer

Existential quantifier in coq impredicative logic (System F)

I was trying to code into Coq logical connectives encoded in lambda calculus with type à la System F. Here is the bunch of code I wrote (standard things, I think) Definition True := forall X: Prop, X -> X. Lemma I: True. Proof. unfold True.…
1
2