This code type-checks:
type T :: Type -> foreach (r :: Type) -> Type -> Type
data T k r a
type T' :: Type -> Type
type T' a = T a Identity a
Type -> Type
(ie., Identity
) here? It fails to type-check if you replace Identity
with say Int
.foreach
keyword, and how does one use it in Haskell?It's not a keyword, just an implicitly quantified type variable. It's like when you write a function
foo :: [Int] -> foreach Bool -> Double
foo = undefined
main = print $ foo [1,2,3] (Just True)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.