haskell
Haskell pure functional programming with monads and type classes. Use for .hs files.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Haskell
An advanced, purely functional programming language.
When to Use
- Academic Research
- Compilers / DSLs
- Financial Systems (correctness)
- High-assurance software
Quick Start
main :: IO ()
main = putStrLn "Hello, World!"
factorial :: Integer -> Integer
factorial 0 = 1
factorial n = n * factorial (n - 1)
Core Concepts
Pure Functions
Functions have no side effects. Output depends only on input.
Lazy Evaluation
Expressions are not evaluated until their results are needed.
ints = [1..] -- Infinite list
take 5 ints -- [1, 2, 3, 4, 5]
Type System
Strong, static typing with type inference and Type Classes (similar to Interfaces).
class Eq a where
(==) :: a -> a -> Bool
Monads
A structure that represents computations defined as sequences of steps (e.g., IO, Maybe).
Best Practices
Do:
- Use HLint
- Write type signatures for top-level functions
- Use pattern matching
Don't:
- Write partial functions (e.g.,
headon empty list) if possible - Use complex monad stacks without abstraction
References
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-03-11
- 索引更新时间
- 2026-03-11
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!