Syntic

Skills may execute instructions and code that could affect your environment. Marketplace scans reduce risk but do not guarantee safety. Always review files, run your own security checks, and use at your own risk.

LanguagesFree Safe

Haskell Developer

Security Scan Summary

Status: Safe

Source: Syntic Skills registry

Automated security scan completed with no high-risk patterns detected. Manual review is still required.

About This Skill

Use when writing pure functional code in Haskell with type-driven design, monads, type classes, and GHC extensions.

Downloadable SKILL.md

Download SKILL.md and place it in your Syntic skills folder. For Syntic Code, install in your local skills directory, review contents, and run in a controlled environment first. Acknowledge the risk notice above to enable the download.

SKILL.md
---
name: Haskell Developer
description: Use when writing pure functional code in Haskell with type-driven design, monads, type classes, and GHC extensions.
category: Languages
version: 1.0.0
tools: []
---

# Haskell Development

Write correct, composable, and performant purely functional code using the type system as a design tool.

## Type-Driven Design

1. Start by defining types for the domain. Model the problem space with algebraic data types before writing functions.
2. Use sum types (tagged unions) to enumerate all possible states. Each constructor carries relevant data.
3. Use **newtypes** to wrap primitives with domain semantics: `newtype UserId = UserId Int`, `newtype Email = Email Text`.
4. Make functions total. Every input produces valid output. Use `Maybe`, `Either`, or custom error types instead of partial functions (`head`, `fromJust`).
5. Use phantom types and **GADTs** to encode state machines at type level (invalid transitions compile as errors).

## Monad and Effect Management

- **mtl style** (MonadReader, MonadState, MonadError) for polymorphic effect stacks interpretable in production and tests.
- Structure apps with `ReaderT Env IO` pattern for simple apps or `Eff`/`Polysemy` for complex effects.
- Keep `IO` at outer edges only. Push to boundary; keep core logic pure.
- `ExceptT` for recoverable errors in effect stacks. `throwIO` only for truly exceptional situations.
- Compose monadic actions with `do` notation (sequential), `traverse` (mapping effects), `concurrently` from `async` (parallel).

## Type Class Design

- Define type classes for abstracting behavior, not ad-hoc polymorphism. Each should have coherent laws.
- Provide default implementations. Users implement minimal complete definition.
- Use **DerivingStrategies** explicitly: `deriving stock` (GHC built-ins), `deriving newtype` (newtype coercions), `deriving via` (reusable patterns).
- Use `GeneralizedNewtypeDeriving` to automatically derive newtype wrapper instances.
- Document laws in Haddock comments and test them with property-based tests (QuickCheck, Hedgehog).

## Performance Optimization

- Use `Text` from `Data.Text` instead of `String` (linked list = slow).
- Use `ByteString` for binary data. Strict by default; lazy only for streaming.
- Profile with `-prof -fprof-auto`, analyze with `hp2ps` or `ghc-prof-flamegraph`. Look for space leaks.
- Use **BangPatterns** and strict fields (`!`) on data types that are always evaluated. Laziness is default.
- Use `Vector` from `vector` package instead of lists for indexed access and numerical computation.
- Avoid `nub` (O(nΒ²)). Use `Set` or `HashMap` for deduplication.

## Project Structure

- Use `cabal` or `stack` for builds. Define library, executable, test suite stanzas separately.
- Organize by domain: `MyApp.User`, `MyApp.Order`, `MyApp.Payment`. Internal under `MyApp.Internal`.
- Export only public API. Use explicit export lists.
- Use `hspec` or `tasty` for test frameworks. `QuickCheck` for property-based testing.
- Enable GHC extensions per module with `{-# LANGUAGE ... #-}` pragmas, not globally.

## Common GHC Extensions

- `OverloadedStrings` for `Text` and `ByteString` literals. `OverloadedLists` for `Vector` and `Map`.
- `LambdaCase` for cleaner pattern matching on function arguments.
- `RecordWildCards` for convenient record field binding.
- `TypeApplications` for explicit type arguments: `read @Int "42"`.
- `ScopedTypeVariables` for bringing type variables into scope in function bodies.

## Testing

- **QuickCheck** for property-based testing. **Hedgehog** as alternative with better shrinking.
- Define generators for domain types with `gen/fmap` and `gen/bind`.
- Test laws of type class instances: reflexivity, transitivity, etc.

Bundle Download

Includes SKILL.md and bundled support files where provided. Risk acknowledgement is required.

Install Targets

Syntic App

  1. 1. Create a dedicated folder for this skill in your local skills library.
  2. 2. Place SKILL.md into that folder.
  3. 3. Restart Syntic and invoke this skill on matching tasks.

Syntic Code (CLI)

  1. 1. Save SKILL.md in your local Syntic Code skills directory.
  2. 2. Keep related files in the same skill folder.
  3. 3. Run in a safe environment and validate outputs.

Source

https://github.com/rohitg00/awesome-claude-code-toolkit/blob/main/agents/language-experts/haskell-developer.md

Open Source Link
Languages

Related Skills