polykinds

Is there a general way to apply constraints to a type application?

本秂侑毒 提交于 2019-12-21 04:49:48
问题 A comment by user 2426021684 led me to investigate whether it was possible to come up with a type function F such that F c1 c2 fa demonstrates that for some f and a : fa ~ f a c1 f c2 a It turns out that the simplest form of this is quite easy. However, I found it rather difficult to work out how to write a poly-kinded version. Fortunately, I managed to find a way as I was writing this question. 回答1: First, some boilerplate: {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ConstraintKinds #-} {-#

What does * (star) or other kinds mean in an instance list of haddock

你。 提交于 2019-12-19 18:22:09
问题 Browsing the haddocks of various packages I often come along instance documentations that look like this (Control.Category): Category k (Coercion k) Category * (->) or this (Control.Monad.Trans.Identity): MonadTrans (IdentityT *) What exactly here does the kind signature mean? It doesn't show up in the source, but I have already noticed that it seems to occur in modules that use the PolyKinds extension. I suspect it is probably like a TypeApplication but with a kind. So that e.g. the last

Is polykinded type application injective?

試著忘記壹切 提交于 2019-12-04 01:18:48
问题 Is polykinded type application injective? When we enable PolyKinds, do we know that f a ~ g b implies f ~ g and a ~ b ? Motivation When trying to answer another question, I reduced the problem to the point that I received the following error only with PolyKinds enabled. Could not deduce (c1 ~ c) from the context ((a, c z) ~ (c1 a1, c1 b)) If polykinded type application were injective, we could deduce c1 ~ c as follows. (a, c z) ~ (c1 a1, c1 b) (a,) (c z) ~ (c1 a1,) (c1 b) {- switch to prefix

Is there a general way to apply constraints to a type application?

岁酱吖の 提交于 2019-12-03 14:39:37
A comment by user 2426021684 led me to investigate whether it was possible to come up with a type function F such that F c1 c2 fa demonstrates that for some f and a : fa ~ f a c1 f c2 a It turns out that the simplest form of this is quite easy. However, I found it rather difficult to work out how to write a poly-kinded version. Fortunately, I managed to find a way as I was writing this question. First, some boilerplate: {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-#

What does * (star) or other kinds mean in an instance list of haddock

拈花ヽ惹草 提交于 2019-12-01 17:24:20
Browsing the haddocks of various packages I often come along instance documentations that look like this ( Control.Category ): Category k (Coercion k) Category * (->) or this ( Control.Monad.Trans.Identity ): MonadTrans (IdentityT *) What exactly here does the kind signature mean? It doesn't show up in the source, but I have already noticed that it seems to occur in modules that use the PolyKinds extension. I suspect it is probably like a TypeApplication but with a kind. So that e.g. the last example means that IdentityT is a monad transformer if it's first argument has kind * . So my

Is polykinded type application injective?

孤人 提交于 2019-12-01 04:18:37
Is polykinded type application injective? When we enable PolyKinds , do we know that f a ~ g b implies f ~ g and a ~ b ? Motivation When trying to answer another question , I reduced the problem to the point that I received the following error only with PolyKinds enabled. Could not deduce (c1 ~ c) from the context ((a, c z) ~ (c1 a1, c1 b)) If polykinded type application were injective, we could deduce c1 ~ c as follows. (a, c z) ~ (c1 a1, c1 b) (a,) (c z) ~ (c1 a1,) (c1 b) {- switch to prefix notation -} c z ~ c1 b {- f a ~ g b implies a ~ b -} c ~ c1 {- f a ~ g b implies f ~ g -} c1 ~ c {- ~