Ad

Try to upgrade codewars haskell-runner ghc to new version but fail one test.

Code extract from test/runner/haskell_spec.js

This code run fine here but failed on stackage lts-1.0 w/ ghc7.6.3

test.hs:38:12: error:
    • Couldn't match type ‘IO ()’ with ‘() -> IO ()’
      Expected type: ActionWith ()
        Actual type: IO ()
    • Possible cause: ‘deleteIfExists’ is applied to too many arguments
      In the first argument of ‘after’, namely
        ‘(deleteIfExists moviesDBFileName)’
      In the expression: after (deleteIfExists moviesDBFileName)
      In the second argument of ‘($)’, namely
        ‘after (deleteIfExists moviesDBFileName)
         $ do { it "contains the movies we expect"
                $ do { mkMoviesDB;
                       movies <- getMovies;
                       .... } }’
{-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies #-}
{-# LANGUAGE OverloadedStrings, GADTs, FlexibleContexts, MultiParamTypeClasses #-}
{-# LANGUAGE NoMonomorphismRestriction, GeneralizedNewtypeDeriving #-}
module Movies where
import Database.Persist (insertMany)
import Database.Persist.Sqlite (runSqlite, runMigration)
import Database.Persist.TH (mkPersist, mkMigrate, persistUpperCase, share, sqlSettings)
share [mkPersist sqlSettings, mkMigrate "migrateTables"] [persistUpperCase|
Movies
   title    String
   year     Int
   rating   Int
   deriving Eq Show
|]
mkMoviesDB :: IO ()
mkMoviesDB = runSqlite "/tmp/movies.db" $ do
  runMigration migrateTables
  insertMany
    [ Movies "Rise of the Planet of the Apes" 2011 77
    , Movies "Dawn of the Planet of the Apes" 2014 91
    , Movies "Alien" 1979 97
    , Movies "Aliens" 1986 98
    , Movies "Mad Max" 1979 95
    , Movies "Mad Max 2: The Road Warrior" 1981 100
    ]
  return ()