Offline receipt of declaration in Template Haskell quote

Why does the Haskell pattern ignore offline receipt of an ad in a quote?

{-# LANGUAGE TemplateHaskell, StandaloneDeriving #-} data Test a = Test a $([d| deriving instance Show a => Show (Test a); fx = x |]) 
 ghci> :l Test.hs [1 of 1] Compiling Main ( Test.hs, interpreted ) Ok, modules loaded: Main. ghci> :tf f :: t -> t ghci> Test 1 :: Test Int <interactive>:18:1: No instance for (Show (Test Int)) arising from a use of `print' Possible fix: add an instance declaration for (Show (Test Int)) In a stmt of an interactive GHCi command: print it 
+7
source share
1 answer

This was a compiler flaw where the Haskell template data type for declarations is not even able to store a standalone output instance (see http://hackage.haskell.org/packages/archive/template-haskell/2.8.0.0/doc/html/Language- Haskell-TH-Syntax.html # t: Dec ).

Starting from 7.10, this error has been fixed. (Thanks to @VladimirStill for pointing this out in the comment below.)

+7
source

All Articles