Typeable型クラス
実行時に型を知るための方法を提供する
Data.Typeable
https://hackage.haskell.org/package/base-4.15.0.0/docs/Data-Typeable.html
methods
typeOf :: a -> TypeRep
例
code:ghci
ghci> import Type.Reflection
ghci> :t typeOf
typeOf :: Typeable a => a -> TypeRep a
ghci> typeOf True
Bool
ghci> typeOf 3, 1, 2
Integer
#??
何に使う?
何が嬉しい?
いつ使う?
使用する前後でどのように挙動が変わる?
簡単な具体例を見たい
https://twitter.com/mod_poppo/status/969429015302848519
どういう仕組み?
uni-typedみたいな?
Haskellの動的型付け、みたいな概念と関連があるのか?
静的解析をスルーして、実行時にのみ型チェックするみたいな?
Data型クラス
DeriveDataTypeable
Dynamic Typing in a Statically Typed Language
https://www.hpl.hp.com/techreports/Compaq-DEC/SRC-RR-47.pdf
A lightweight implementation of generics and dynamics
Scrap your boilerplate: a practical design pattern for generic programming
https://www.microsoft.com/en-us/research/publication/scrap-your-boilerplate-a-practical-approach-to-generic-programming
Scrap your boilerplate with class: extensible generic functions
https://www.microsoft.com/en-us/research/publication/scrap-your-boilerplate-with-class/
https://hackage.haskell.org/package/effin
https://chrisdone.com/posts/data-typeable/
良い感じの解説記事
https://kowainik.github.io/posts/deriving#typeable
kowainik
https://stackoverflow.com/a/6604087
https://sras.me/haskell/what-the-heck-is-typeable.html
https://qiita.com/mod_poppo/items/a4bbed44ccfa59740f32
https://typesandkinds.wordpress.com/2016/01/22/haskell-as-a-gradually-typed-dynamic-language
https://downloads.haskell.org/~ghc/8.10.1/docs/html/users_guide/glasgow_exts.html#deriving-typeable-instances
https://kowainik.github.io/posts/extensions
https://hackage.haskell.org/package/dynamic