Haskell 的 Typeclass type怎么理解

named overloading
named overloading
就是lexical scope,let ... in 和 where什么的都是sugered lambda,LISP的let,let*,letrec也是sugered lambda。只是语法糖而已。&br&python作用域才古怪呢,因为完全不区分申明和赋值,python并不完全是按lexical scope来的,比如你要ref外面作用域的变量是没问题的,但是要赋值给它,为了区分在这个作用域赋值给一个同名变量,只能给变量前面加global之类的东西(很多情况这个都做不到)。
就是lexical scope,let ... in 和 where什么的都是sugered lambda,LISP的let,let*,letrec也是sugered lambda。只是语法糖而已。 python作用域才古怪呢,因为完全不区分申明和赋值,python并不完全是按lexical scope来的,比如你要ref外面作用域的变量是没…
&b&drracket-vim-tool&/b& :adds vim-like editing to the definitions area of DrRacket&br&&a href=&///?target=https%3A///takikawa/drracket-vim-tool& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&takikawa/drracket-vim-tool 路 GitHub&i class=&icon-external&&&/i&&/a&
drracket-vim-tool :adds vim-like editing to the definitions area of DrRacket
已有帐号?
无法登录?
社交帐号登录君,已阅读到文档的结尾了呢~~
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
Haskell語言Typeclass全解
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口(唠嗑专线~小美)
(simeon.chaos)
第三方登录:Data.TypeableContentsDescriptionThe
class reifies types to some extent by associating type
representations to types. These type representations can be compared,
and one can in turn define a type-safe cast operation. To this end,
an unsafe cast is guarded by a test for type (representation)
equivalence. The module
uses Typeable for an
implementation of dynamics. The module
uses Typeable
and type-safe cast (but not dynamics) to support the &Scrap your
boilerplate& style of generic programming.Compatibility NotesSince GHC 7.8,
is poly-kinded. The changes required for this might
break some old programs involving . More details on this, including
how to fix your code, can be found on the
Synopsisclass
a :: forall proxy a.
a =& proxy a -& data a
b where ::
a :: forall a.
:: forall t a.
t =& t a -&
:: forall t a b.
t =& t a b -&
:: forall t a b c.
t =& t a b c -&
:: forall t a b c d.
t =& t a b c d -&
:: forall t a b c d e.
t =& t a b c d e -&
:: forall t a b c d e f.
t =& t a b c d e f -&
:: forall t a b c d e f g.
t =& t a b c d e f g -& type
a :: forall a b. ( a,
b) =& a -&
b :: forall a b. ( a,
b) :: forall a b c. ( a,
b) =& c a -&
(c b) :: forall c t t' a. ( t,
t') =& c (t a) -&
(c (t' a)) :: forall c t t' a b. ( t,
t') =& c (t a b) -&
(c (t' a b))data
-& (, []) ::
-& []The Typeable classclass
a The class
allows a concrete representation of a type to
be calculated.Minimal complete definitionInstances * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * ()& * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * & * &( (k1 -& k) s,
k (s a)Kind-polymorphic Typeable instance for type application ((* -& *) -& ) & ((* -& *) -& ) & (* -& * -& * -& * -& * -& * -& * -& *) & (* -& * -& * -& * -& * -& * -& *) & (* -& * -& * -& * -& * -& *) & (* -& * -& * -& * -& *) & (* -& * -& * -& *) & (* -& * -& *) (-&)& (* -& * -& *) & (* -& * -& *) & (* -& * -& *) & (* -& * -& *) & (* -& *) []& (* -& *) & (* -& *) & (* -& *) & (* -& *) & (* -& *) & (* -& *) & (* -& *) & (* -& *) & (* -& *) & (* -& *) & (* -& *) & (* -& *) & (* -& *) & (* -& *) & (* -& *) & (* -& *) & (* -& ) & (k -& k -& *) ( k)& (k -& k -& *) ( k)& (k -& *) ( k)& :: forall proxy a.
a =& proxy a -&
Takes a value of type a and returns a concrete representation
of that type.Since: 4.7.0.0Propositional equalitydata a
b where infix 4 Propositional equality. If a :~: b is inhabited by some terminating
value, then the type a is the same as the type b. To use this equality
in practice, pattern-match on the a :~: b to get out the Refl
in the body of the pattern-match, the compiler knows that a ~ b.Since: 4.7.0.0Constructors ::
a&Instances k ( k)& k ( k a)& k ( k a)& (k -& k -& *) ( k)&(~) k a b =&
( k a b)&(~) k a b =&
( k a b)& ( k a b)&((~) * a b,
( * a b)& ( k a b)&(~) k a b =&
( k a b)& ( k a b)&For backwards compatibility :: forall a.
:: forall t a.
t =& t a -&
:: forall t a b.
t =& t a b -&
:: forall t a b c.
t =& t a b c -&
:: forall t a b c d.
t =& t a b c d -&
:: forall t a b c d e.
t =& t a b c d e -&
:: forall t a b c d e f.
t =& t a b c d e f -&
:: forall t a b c d e f g.
t =& t a b c d e f g -&
a Deprecated: renamed to type
a Deprecated: renamed to type
a Deprecated: renamed to type
a Deprecated: renamed to type
a Deprecated: renamed to type
a Deprecated: renamed to type
a Deprecated: renamed to Type-safe cast :: forall a b. ( a,
b) =& a -&
b The type-safe cast operation :: forall a b. ( a,
b) Extract a witness of equality of two typesSince: 4.7.0.0 :: forall a b c. ( a,
b) =& c a -&
(c b) A flexible variation parameterised in a type constructorGeneralized casts for higher-order kinds :: forall c t t' a. ( t,
t') =& c (t a) -&
(c (t' a)) Cast over k1 -& k2 :: forall c t t' a b. ( t,
t') =& c (t a b) -&
(c (t' a b)) Cast over k1 -& k2 -& k3A canonical proxy typedata
t A concrete, poly-kinded proxy typeConstructors&Instances ( *)& ( *)& ( *)& ( *)& ( *)& ( k s)& ( k s)& ( k s)& t =&
( * t)& ( k s)& ( k s)& ( k s)& ( k s)& ( * t)& ( * s)& (k -& *) ( k)&type
( k t)&Type representationsdata
A concrete representation of a (monomorphic) type.
supports reasonably efficient equality.Instances & & & * & ::
An abstract representation of a type constructor.
objects can
be built using .Instances & & & * & ::
Deprecated: renamed to ;
are also available.Observe string encoding of a type representation ::
Since: 4.5.0.0 ::
Since: 4.5.0.0 ::
Since: 4.5.0.0Construction of type representations Arguments:: package name-& module name-& the name of the type constructor-& A unique
objectBuilds a
object representing a type constructor.
implementation of
should ensure that the following holds: A==A' ^ B==B' ^ C==C' ==& mkTyCon A B C == mkTyCon A' B' C' ::
Applies a type constructor to a sequence of types ::
Adds a TypeRep argument to a TypeRep. ::
A special case of , which applies the function
type constructor to a pair of types.Observation of type representations ::
-& (, []) Splits a type constructor application ::
Applies a type to a function type.
first argument represents a function of type t -& u and the
second argument represents a function of type t.
Otherwise,
returns . ::
Observe the type constructor of a type representation ::
-& [] Observe the argument types of a type representation}

我要回帖

更多关于 haskell type class 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信