[Solved]Why I cannot code `data family GMap k :: Type -> Type` like GHC docs?

Hello,
I’m learning Type Families of Haskell now.And in GHC’s related docs ,it has example like this:

data family GMap k :: Type -> Type

And I have got the annotation Type is supported by language extension [PolyKinds](https://downloads.haskell.org/ghc/latest/docs/users_guide/exts/poly_kinds.html) now.But when I try the code above like this:

{-# LANGUAGE PolyKinds,TypeFamilies,DataKinds #-}

data family GMap k :: Type -> Type

:sob:It throw errors:

temp.hs:3:23: error: Not in scope: type constructor or class ‘Type’

|

3 | data family GMap k :: Type -> Type

That makes me confused.Could someone tell me why?:sob:

1 Like

You need import Data.Kind (Type)

2 Likes

!
Thank you for your reply.:sob:That’s my stupid.

1 Like

By the way, you shouldn’t need PolyKinds or DataKinds for this snippet.

1 Like

You’re welcome!


1 Like