Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haskell的kind by xyyiii #122

Open
freizl opened this issue Apr 30, 2018 · 2 comments
Open

Haskell的kind by xyyiii #122

freizl opened this issue Apr 30, 2018 · 2 comments
Labels

Comments

@freizl
Copy link
Member

@freizl freizl commented Apr 30, 2018

data Frank a b  = Frank {frankField :: b a} 
                            deriving (Show)

大家好。我是haskell新手玩家。。。= =。看haksell 趣味指南
对于这段代码怎么理解。尤其是这个花括号是什么语法形式

@freizl freizl added the migration label Apr 30, 2018
@freizl
Copy link
Member Author

@freizl freizl commented Apr 30, 2018

frankField 是一个函数,类型为 Frank a b -> b a,相当于是 Frank的反函数

@freizl
Copy link
Member Author

@freizl freizl commented Apr 30, 2018

主要可以理解为简化如下定义

data Frank a b = Frank (b a)
                 deriving (Show)

frankField :: Frank a b => b a
frankField Frank (b a) = b a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant