haskell-graphql / graphql-api

Write type-safe GraphQL services in Haskell
BSD 3-Clause "New" or "Revised" License
406 stars 35 forks source link

Illegal type: ‘"Hello"’ Perhaps you intended to use DataKinds #179

Closed theobat closed 6 years ago

theobat commented 6 years ago

hey, I'm struggling with the very basic examples:

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}

import Data.Text (Text)
import Data.Monoid ((<>))

import GraphQL
import GraphQL.API
import GraphQL.Resolver (Handler)

type Hello = Object "Hello" '[]
  '[ Argument "who" Text :> Field "greeting" Text ]

Yields:

error:
    Illegal type: ‘"Hello"’ Perhaps you intended to use DataKinds
   |
16 | type Hello = Object "Hello" '[]
   |                     ^^^^^^^

And many others like that... Any idea of what I could be doing wrong ?

theobat commented 6 years ago

adding the suggested {-# LANGUAGE DataKinds #-} seems to fix the problem, perhaps this should be added in the readme snippet...

ronanyeah commented 6 years ago

I just got burned by this.

@theobat If you reopen this issue I am willing to make a PR to the README.