Questions tagged [constraint-kinds]

Use this tag for asking question related to Constraint Kind or/and ConstraintKinds GHC extension.

ConstraintKinds is an GHC Haskell extension. Also it is a type of kind.

Interesting Questions:

36 questions
1
vote
1 answer

Conversion of distributive type families of constraints

Hypothesis: Type families which result in Constraints are always distributive over their representational parameters. As an example, Fam x Eq `And` Fam x Show is equivalent to Fam x (Eq `And` Show) if Fam's second parameter has a representational…
yairchu
  • 23,680
  • 7
  • 69
  • 109
1
vote
1 answer

Reducing satisfied constraints to ordinary types

I understand the following type family shouldn't and perhaps can't be implemented in GHC: type family MatchesConstraint c a :: Bool where MatchesConstraint c a is True if (c a) MatchesConstraint c a is False otherwise This is problematic…
Clinton
  • 22,361
  • 15
  • 67
  • 163
1
vote
2 answers

How to abstract constraints in function with Rank-2 type?

The following snippet of code borrows from the Haskell wiki to carry around a typeclass dictionary along with an existential type: {-# language ExistentialQuantification #-} module Experiment1 where data Showable = forall x. Show x => Showable…
Rehno Lindeque
  • 4,236
  • 2
  • 23
  • 31
1
vote
0 answers

Resolving super-class constraints in a static form

I want to write a typeclass for types that have a static pointer to a dictionary that can discharge the super class constraints. In this contrived example the super-constraint is Typeable, since modern GHC versions automatically provides the…
cdk
  • 6,698
  • 24
  • 51
0
votes
1 answer

Haskell: interaction between ConstraintKinds, and TypeSynonymInstances

I'm getting an unexpected error when trying to compile a small Haskell file with GHC 8.6.1 when using ConstraintKinds and TypeSynonymInstances. I'd like to make a class that takes a class as a parameter, and I'd like to use an alias when writing an…
Fried Brice
  • 769
  • 7
  • 20
0
votes
0 answers

Higher kinded type on typeclass?

To find out, if a type is a higher kinded type ghci provide: Prelude> :k Maybe Maybe :: * -> * And tried on typeclass like: Prelude> :k Functor Functor :: (* -> *) -> Constraint Why can I ask for higher kinded type on typeclass? What does…
softshipper
  • 32,463
  • 51
  • 192
  • 400
1 2
3