TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Anti-Instances in Haskell

20 点作者 hkailahi将近 2 年前

1 comment

gizmo686将近 2 年前
I haven&#x27;t touched Haskell in a while, but it seems like this is solving the wrong problem. If you have a data type and a type class, there are 3 places you can make the type an instance of the typeclass:<p>1) Where you define the data type 2) Where you define the typeclass, or 3) Anywhere else<p>If you are in either 1 or 2, then you are the one who wrote either the type or the type class, and so probably know what you are doing. If the maintainer of the type and typeclass disagree on if they are compatible, that should probably be settled through concersation, not one side marking them as such in code.<p>If you are in situation 3, then just don&#x27;t. Even if there is nothing inherently wrong with the tupe being an instance of the type class, an unrelated module defining it will cause nothing but problems. What if a different module had the same idea? What if one of the two original modules decide to add it?
评论 #37045075 未加载