I'm trying to follow the tutorial for the Beam Haskell library: https://tathougies.github.io/beam/tutorials/tutorial1/
module Lib
    ( someFunc
    ) where
{-# LANGUAGE
    DeriveGeneric
  , GADTs
  , OverloadedStrings
  , FlexibleContexts
  , FlexibleInstances
  , TypeFamilies
  , TypeApplications
 #-}
import Database.Beam
import Database.Beam.Postgres
import GHC.Generics
import Data.Text (Text)
data UserT f
    = User
    { _userEmail     :: Columnar f Text
    , _userFirstName :: Columnar f Text
    , _userLastName  :: Columnar f Text
    , _userPassword  :: Columnar f Text }
    deriving Generic
someFunc :: IO ()
someFunc = putStrLn "someFunc"
This results in the following error:
    • Can't make a derived instance of ‘Generic (UserT f)’:
        You need DeriveGeneric to derive an instance for this class
    • In the data declaration for ‘UserT’
   |
27 |     deriving Generic
   |              ^^^^^^^
Note that the DeriveGeneric language pragma is present.
What am I missing here?
Build environment:
A {-# LANGUAGE #-} declaration needs to go at the very top of the file, before the module declaration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With