[英]GHC does not accept GADT type signature
該聲明不起作用:
data Identity a where {Identity :: (->) a (Identity a)}
如何解決這個問題?
至少從GHC 7.8開始, 如果你打開GADT支持,那么你的代碼可以檢查並做你期望的事情 :
{-# LANGUAGE GADTs #-}
data Identity a where {Identity :: (->) a (Identity a)}
導致:
GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( foo.hs, interpreted )
Ok, modules loaded: Main.
λ» :i Identity
data Identity a = Identity a -- Defined at foo.hs:2:1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.