Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cabal install throwing ExitFailure 1 when building Yesod project

Tags:

haskell

yesod

I'm new to Haskell web development and frameworks, and I've been following this tutorial. I've run yesod init to create a project. Then I cd'd into the project folder and ran:

$ cabal sandbox init
$ cabal install --enable-tests --reorder-goals --max-backjumps=-1 -j

I ran into a couple dependency issues here and there, but have figured all of that out thus far. Now I've come across an error during the build process that I can't seem to find any answers or fixes for. The build process ends abruptly with an ExitFailure 1.

Here is the full error message:

Model.hs:13:1:
Illegal instance declaration for
  ‘ToBackendKey
     persistent-2.0.8:Database.Persist.Sql.Types.SqlBackend Email’
  (All instance types must be of the form (T t1 ... tn)
   where T is not a synonym.
   Use TypeSynonymInstances if you want to disable this.)
In the instance declaration for
  ‘ToBackendKey persistent-2.0.8:Database.Persist.Sql.Types.SqlBackend Email’

Model.hs:13:1:
Illegal instance declaration for
  ‘ToBackendKey
     persistent-2.0.8:Database.Persist.Sql.Types.SqlBackend User’
  (All instance types must be of the form (T t1 ... tn)
   where T is not a synonym.
   Use TypeSynonymInstances if you want to disable this.)
In the instance declaration for
  ‘ToBackendKey persistent-2.0.8:Database.Persist.Sql.Types.SqlBackend User’
cabal: Error: some packages failed to install:
Wordscape-0.0.0 failed during the building phase. The exception was:
ExitFailure 1

Has anybody else experienced an error like this / know how to remedy it? Any help would be appreciated. Thanks!

like image 976
Rhitakorrr Avatar asked Jan 31 '26 06:01

Rhitakorrr


1 Answers

adding

{-# LANGUAGE TypeSynonymInstances #-}

at the top of Model.hs should fix it, as should upgrading to persistent-2.1 (although you might not be able to do that until tomorrow).

like image 72
Greg Weber Avatar answered Feb 02 '26 20:02

Greg Weber