相关疑难解决方法(0)

模式中的类型推断

我注意到GHC想要一种类型签名,我认为应该推断出来.我把我的例子最小化到了这个,这几乎肯定没有任何意义(我不建议在你最喜欢的类型上运行它):

{-# LANGUAGE GADTs, RankNTypes, ScopedTypeVariables,
             TypeOperators, NoMonomorphismRestriction #-}
module Foo where

import Data.Typeable

data Bar rp rq

data Foo b = Foo (Foo b)


rebar :: forall rp rq rp' rp'' . (Typeable rp', Typeable rp'') 
     => Proxy rp' -> Proxy rp'' -> Foo rp -> Foo (Bar rp rq)
rebar p1 p2 (Foo x) =
  -- The signature for y should be inferred...
  let y = rebar p1 p2 x -- :: Foo (Bar rp rq)
  -- The …
Run Code Online (Sandbox Code Playgroud)

haskell ghc

6
推荐指数
1
解决办法
140
查看次数

标签 统计

ghc ×1

haskell ×1