Questions tagged «associated-types»

1
使用模板Haskell获取关联的类型同义词
模板Haskell可以找出在类型类中声明的相关类型同义词的名称和/或声明吗?我曾期望reify会做我想做的事,但似乎并没有提供所有必要的信息。它适用于获取函数类型签名: % ghci GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help ... Prelude> -- I'll be inserting line breaks and whitespace for clarity Prelude> -- in all GHCi output. Prelude> :set -XTemplateHaskell Prelude> import Language.Haskell.TH Prelude Language.Haskell.TH> class C a where f :: a -> Int Prelude Language.Haskell.TH> putStrLn $(stringE . …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.