Dlaczego szablon Haskell ignoruje samodzielne wyprowadzenie deklaracji w ofercie?Autonomiczna deklaracja pochodna w szablonie Haskell quotation
{-# LANGUAGE TemplateHaskell, StandaloneDeriving #-}
data Test a = Test a
$([d| deriving instance Show a => Show (Test a); f x = x |])
ghci> :l Test.hs
[1 of 1] Compiling Main (Test.hs, interpreted)
Ok, modules loaded: Main.
ghci> :t f
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
Prawda, zauważyłem brak samodzielnego pozyskiwania costructor w bibliotece. Miałem nadzieję, że uda się to osiągnąć poprzez cytaty. – leventov
Podejrzeń, że tak jest, ponieważ samodzielne wyprowadzanie dzieje się we wcześniejszej fazie kompilacji niż szablon Haskell. W renamerze zamiast typechecker, czy coś takiego. –
Powinno działać od GHC 7.10, zobacz https://ghc.haskell.org/trac/ghc/ticket/8100. –