[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75NRA919JM85JMAG6FX80GH":3,"skill-same:01M75NRA919JM85JMAG6FX80GH":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M75NRA919JM85JMAG6FX80GH","haskell",null,"Expert Haskell development skill. Covers type-driven design, GHC extensions, Cabal\u002FStack\u002FNix builds, performance optimization, testing, and the modern Haskell library ecosystem. Activate for any Haskell programming, debugging, or architecture tasks.","javimosch\u002Fopen-claw-skills","javimosch","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F12900508?v=4","01M6D3F2AS6PV75ET9PZ1QGP8J","Javier Leandro Arancibia","01M75B8NCTAJG9WH5YNZH7C3D8",0,"MIT","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmightybyte\u002Fhaskell\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: haskell\ndescription: Expert Haskell development skill. Covers type-driven design, GHC extensions, Cabal\u002FStack\u002FNix builds, performance optimization, testing, and the modern Haskell library ecosystem. Activate for any Haskell programming, debugging, or architecture tasks.\n---\n\n# Haskell Development Guide\n\n## Core Philosophy\n\n1. **Types are the design** — Make illegal states unrepresentable. If the type checker accepts it, we would like it to be correct.\n2. **Purity by default** — Side effects are explicit in the type system. `IO` is a feature, not a burden.\n3. **Composition over inheritance** — Small, composable functions. Typeclasses for ad-hoc polymorphism.\n4. **Laziness as a tool** — Enables elegant abstractions but demands awareness of space leaks.\n5. **Correctness first, then performance** — Get it right, then profile, then optimize.\n5. **Keep it Simple** — Purity and strong types (i.e. roughly Haskell2010) gives you the majority of Haskell's value.  Avoid more advanced language features unless absolutely necessary.\n\n## Project Setup\n\n### Cabal (preferred with Nix)\n\n```bash\nmkdir my-project && cd my-project\ncabal init --interactive\n```\n\nMinimal `my-project.cabal`:\n```cabal\ncabal-version: 3.0\nname:          my-project\nversion:       0.1.0.0\nbuild-type:    Simple\n\ncommon warnings\n    ghc-options: -Wall -Werror -Wcompat -Widentities\n                 -Wincomplete-record-updates\n                 -Wincomplete-uni-patterns\n                 -Wpartial-fields\n                 -Wredundant-constraints\n\nlibrary\n    import:           warnings\n    exposed-modules:  MyProject\n    build-depends:    base >= 4.17 && \u003C 5\n                    , text\n                    , containers\n                    , aeson\n    hs-source-dirs:   src\n    default-language:  Haskell2010\n    default-extensions:\n        DeriveGeneric\n        DerivingStrategies\n        LambdaCase\n        ScopedTypeVariables\n\nexecutable my-project\n    import:           warnings\n    main-is:          Main.hs\n    build-depends:    base, my-project\n    hs-source-dirs:   app\n    default-language: Haskell2010\n\ntest-suite tests\n    import:           warnings\n    type:             exitcode-stdio-1.0\n    main-is:          Main.hs\n    build-depends:    base, my-project, hspec, QuickCheck\n    hs-source-dirs:   test\n    default-language: Haskell2010\n```\n\n## Project Structure\n\n```\nmy-project\u002F\n├── exe\u002F\n│   └── Main.hs              # Executable entry point (thin — delegates to library)\n├── src\u002F\n│   ├── MyProject.hs          # Public API (re-exports)\n│   ├── MyProject\u002F\n│   │   ├── Types.hs          # Core domain types\n│   │   ├── App.hs            # Application monad, config\n│   │   ├── DB.hs             # Database layer\n│   │   ├── API.hs            # HTTP\u002FAPI layer\n│   │   └── Internal\u002F         # Not exported — implementation details\n│   │       └── Utils.hs\n├── test\u002F\n│   ├── Main.hs\n│   └── MyProject\u002F\n│       ├── TypesSpec.hs\n│       └── DBSpec.hs\n├── my-project.cabal\n├── cabal.project             # Multi-package config, source-repository-packages\n```\n\n## Essential GHC Extensions\n\n### Always Enable (via `default-extensions` in .cabal)\n```haskell\nDeriveGeneric           -- Derives Generic\nDerivingStrategies      -- Explicit: deriving stock, newtype, anyclass, via\nLambdaCase              -- \\case { ... } instead of \\x -> case x of ...\nScopedTypeVariables     -- forall a. ... lets you reference 'a' in where clauses\n```\n\n### Use Freely When Needed\n```haskell\nBangPatterns\nDeriveDataTypeable\nDeriveFunctor\nDeriveGeneric               -- Generic instances for aeson, etc.\nDerivingVia                 -- Derive via newtype coercion\nDuplicateRecordFields       -- Same field name in different records\nExistentialQuantification   -- Hide type variables\nFlexibleContexts            -- Relax context restrictions\nFlexibleInstances           -- Relax instance head restrictions\nFunctionalDependencies      -- fundeps for MPTC\nGeneralizedNewtypeDeriving  -- Derive through newtypes\nMultiParamTypeClasses       -- Typeclasses with multiple params\nNumericUnderscores          -- More readable number syntax\nOverloadedRecordDot         -- record.field syntax (GHC 9.2+)\nOverloadedStrings           -- String literals as Text\u002FByteString\nRankNTypes                  -- Higher-rank polymorphism (forall inside arrows)\nRecordWildCards             -- Controversial but can be used effectively\n```\n\n### Avoid unless there's a significant clear value\n```haskell\nTemplateHaskell         -- Metaprogramming (aeson TH, lens TH). Slows compilation.\nGADTs                   -- Generalized algebraic data types\nTypeFamilies            -- Type-level functions\nDataKinds               -- Promote data constructors to types\nConstraintKinds         -- Alias constraint sets\nUndecidableInstances    -- Sometimes needed for MTL\u002Ftype families. Understand why.\nTypeOperators           -- type a :+: b. Servant uses heavily.\nAllowAmbiguousTypes     -- Pair with TypeApplications for type-level dispatch.\n```\n\n## Type-Driven Development\n\n### Scope accessors with type name to avoid name clashes\n\n```\ndata User = User\n  { _user_firstName :: String\n  , _user_email :: String\n  } deriving (Eq,Ord,Show,Read,Generic)\n```\n\n### Make Illegal States Unrepresentable\n```haskell\n-- BAD: stringly-typed\ndata User = User { _user_role :: String, _user_email :: String }\n\n-- GOOD: types encode constraints\ndata Role = Admin | Editor | Viewer\n  deriving stock (Show, Eq, Ord)\n\nnewtype Email = Email { _unEmail :: Text }  -- smart constructor validates\n\nmkEmail :: Text -> Either EmailError Email\nmkEmail t\n  | \"@\" `T.isInfixOf` t = Right (Email t)\n  | otherwise = Left InvalidEmail\n\ndata User = User\n  { _user_role  :: !Role\n  , _user_email :: !Email\n  }\n```\n\n### Phantom Types for State Machines\n```haskell\ndata Draft\ndata Published\n\ndata Article (s :: Type) = Article\n  { articleTitle   :: !Text\n  , articleContent :: !Text\n  }\n\npublish :: Article Draft -> Article Published\npublish (Article t c) = Article t c\n\n-- Only published articles can be shared\nshare :: Article Published -> IO ()\nshare = ...\n```\n\n### Newtypes for Safety\n```haskell\nnewtype UserId    = UserId    { unUserId    :: Int64 } deriving newtype (Eq, Ord, Show, FromJSON, ToJSON)\nnewtype ProductId = ProductId { unProductId :: Int64 } deriving newtype (Eq, Ord, Show, FromJSON, ToJSON)\n\n-- Now you can't accidentally pass a ProductId where UserId is expected\ngetUser :: UserId -> IO User\n```\n\n## Error Handling\n\n```haskell\n-- Pure errors: Either\nparseConfig :: Text -> Either ConfigError Config\n\n-- App-level errors: ExceptT or MonadError\nclass Monad m => MonadError e m where\n  throwError :: e -> m a\n  catchError :: m a -> (e -> m a) -> m a\n\n-- The ReaderT pattern (simple, composable)\nnewtype App a = App { unApp :: ReaderT AppEnv IO a }\n  deriving newtype (Functor, Applicative, Monad, MonadIO, MonadReader AppEnv)\n\ndata AppError\n  = NotFound Text\n  | Unauthorized\n  | ValidationError [Text]\n  deriving stock (Show)\n\n-- Throw with exceptions in IO, catch at boundaries\nthrowIO :: Exception e => e -> IO a\ncatch   :: Exception e => IO a -> (e -> IO a) -> IO a\n\n-- RULE: Use Either for expected failures, exceptions for unexpected\u002FIO failures.\n-- Never use error\u002Fundefined in library code.\n```\n\n## Common Patterns\n\n### The ReaderT Pattern\n```haskell\ndata AppEnv = AppEnv\n  { appDbPool   :: !Pool Connection\n  , appLogger   :: !Logger\n  , appConfig   :: !Config\n  }\n\nnewtype App a = App (ReaderT AppEnv IO a)\n  deriving newtype (Functor, Applicative, Monad, MonadIO, MonadReader AppEnv)\n\nrunApp :: AppEnv -> App a -> IO a\nrunApp env (App m) = runReaderT m env\n\n-- Use Has-pattern for granular access:\nclass Has field env where\n  obtain :: env -> field\n\ninstance Has (Pool Connection) AppEnv where\n  obtain = appDbPool\n\ngrabPool :: (MonadReader env m, Has (Pool Connection) env) => m (Pool Connection)\ngrabPool = asks obtain\n```\n\n### Optics (lens\u002Foptics)\n```haskell\n-- With OverloadedRecordDot (GHC 9.2+), often you don't need lens for simple access.\n-- Use lens\u002Foptics for: nested updates, traversals, prisms for sum types.\n\n-- lens: view, set, over\nview _1 (1, 2)       -- 1\nset _1 10 (1, 2)     -- (10, 2)\nover _1 (+1) (1, 2)  -- (2, 2)\n\n-- Compose with (.)\nview (config . database . host) appEnv\nover (users . each . name) T.toUpper myData\n```\n\n## Testing\n\n### HSpec - Testing Framework\n```haskell\n-- test\u002FMyProject\u002FTypesSpec.hs\nmodule MyProject.TypesSpec (spec) where\n\nimport Test.Hspec\nimport MyProject.Types\n\nspec :: Spec\nspec = do\n  describe \"mkEmail\" $ do\n    it \"accepts valid emails\" $\n      mkEmail \"user@example.com\" `shouldBe` Right (Email \"user@example.com\")\n\n    it \"rejects invalid emails\" $\n      mkEmail \"invalid\" `shouldSatisfy` isLeft\n```\n\n### QuickCheck - Property Testing\n```haskell\nimport Test.QuickCheck\n\nprop_reverseReverse :: [Int] -> Bool\nprop_reverseReverse xs = reverse (reverse xs) == xs\n\n-- Generate domain types:\ninstance Arbitrary Email where\n  arbitrary = do\n    user   \u003C- listOf1 (elements ['a'..'z'])\n    domain \u003C- listOf1 (elements ['a'..'z'])\n    pure $ Email $ T.pack $ user \u003C> \"@\" \u003C> domain \u003C> \".com\"\n```\n\n## Performance Essentials\n\n### Strictness\n```haskell\n-- Strict fields in data types (almost always want this):\ndata Config = Config\n  { configHost :: !Text       -- strict (bang pattern in field)\n  , configPort :: !Int\n  }\n\n-- BangPatterns in let bindings:\n{-# LANGUAGE BangPatterns #-}\nlet !result = expensiveComputation\n\n-- Use Text, not String. Always.\n-- Use ByteString for binary data.\n-- Use Vector for indexed access, [] for sequential processing.\n-- Use HashMap\u002FHashSet for large unordered collections.\n-- Use Map\u002FSet for ordered collections or when Ord is available.\n```\n\n### Profiling\n```bash\n# Build with profiling\ncabal build --enable-profiling\n\n# Run with heap profiling\n.\u002Fmy-project +RTS -hc -p -RTS\n\n# Time profiling report\n.\u002Fmy-project +RTS -p -RTS\n# Generates my-project.prof\n\n# Heap profile visualization\nhp2ps -c my-project.hp\n```\n\n### Common Space Leaks\n```haskell\n-- BAD: lazy accumulator\nfoldl (+) 0 [1..1000000]  -- builds giant thunk chain\n\n-- GOOD: strict left fold\nfoldl' (+) 0 [1..1000000]  -- evaluates as it goes\n\n-- BAD: lazy state\nmodify (\\s -> s { count = count s + 1 })  -- thunk builds up\n\n-- GOOD: strict state\nmodify' (\\s -> s { count = count s + 1 })\n-- Or: use strict fields + evaluate\n```\n\n## Commands Reference\n\n| Task | Command |\n|------|---------|\n| Build | `cabal build` |\n| Run | `cabal run my-project` |\n| Test | `cabal test --test-show-details=direct` |\n| REPL | `cabal repl` |\n| Docs | `cabal haddock` |\n| Lint | `hlint src\u002F` |\n| File watch | `ghcid --command=\"cabal repl\"` |\n| Deps outdated | `cabal outdated` |\n| Clean | `cabal clean` |\n| Nix build | `nix build` |\n| Nix dev shell | `nix develop` |\n\n## Common Gotchas\n\n1. **String is [Char]** — Use `Text` (from `text` package) everywhere. Enable `OverloadedStrings` for Text string literals.\n2. **Lazy IO** — `readFile` from Prelude is lazy. Use `Data.Text.IO.readFile` or `ByteString.readFile` instead.\n3. **Orphan instances** — Don't define typeclass instances outside the module that defines the type or the class. Use newtypes to wrap.\n4. **Cabal hell** — Use Nix or cabal's built-in solver (v2-build). Don't use `cabal-install` v1 commands.\n5. **Records** — Field names are global. Prefix field names with a uniform and readable scheme: `_employee_familyName`.\n6. **Partial functions** — Never use `head`, `tail`, `fromJust`, `read` in production code. Use pattern matching or safe alternatives.\n7. **Unsafe operations** - Never use `accursedUnutterablePerformIO`. Only use `unsafePerformIO` when you can prove its use correct.\n8. **Undefined** - `undefined` is a fantastic tool for stubbing things out for incremental development and type checking.  It should never exist in production code.\n9. **foldl vs foldl'** — Always use `foldl'` (strict). The lazy `foldl` from Prelude is almost never what you want.\n10. **Show for serialization** — `Show` is for debugging. Use `aeson` for JSON, `binary`\u002F`cereal` for binary serialization.\n11. **MonadFail** — Pattern match failures in `do` blocks require `MonadFail`. Avoid partial patterns in `do`.\n12. **Template Haskell ordering** — TH splices create declaration groups. All TH splices must come after the declarations they reference and before declarations that reference the generated code.\n\n## Key Libraries\n\n| Library | Purpose |\n|---------|---------|\n| `text` | Unicode text (strict & lazy) |\n| `bytestring` | Binary data |\n| `aeson` | JSON encoding\u002Fdecoding |\n| `postgresql-simple`, `mysql-simple` | Low-level database library |\n| `lens` \u002F `optics` | Composable getters\u002Fsetters |\n| `mtl` | Monad transformer classes |\n| `containers` | Map, Set, Seq (ordered) |\n| `unordered-containers` | HashMap, HashSet (fast) |\n| `vector` | Efficient arrays |\n| `conduit` \u002F `streaming` | Streaming data processing |\n| `warp` | Fast HTTP server |\n| `http-client` | Library for making http requests |\n| `stm` | Software transactional memory |\n| `QuickCheck` | Property-based testing |\n| `hspec` | BDD-style test framework |\n| `tasty` | Test framework (composable) |\n| `criterion` | Benchmarking |\n| `optparse-applicative` | CLI argument parsing |\n| `katip` | Structured logging |\n| `fake` | Generating realistic mock data |\n\n## References\n\nFor detailed information, see:\n- `references\u002Ftype-system.md` — ADTs, GADTs, type families, type classes, DataKinds, phantom types\n- `references\u002Fcommon-patterns.md` — MTL, ReaderT, effect systems, optics, free monads, type-level programming\n- `references\u002Flibraries.md` — Essential library ecosystem with examples\n- `references\u002Fperformance.md` — Strictness, profiling, space leaks, concurrency, benchmarking\n- `references\u002Fghc-extensions.md` — Comprehensive GHC extension guide by category\n- `references\u002Fnix-haskell.md` — Nix-based Haskell development (nixpkgs + haskell.nix)\n- `references\u002Fcabal-guide.md` — Cabal format, multi-package projects, Hackage publishing\n- `references\u002Fbest-practices.md` — Code organization, Haddock, CI, style guide\n","# Haskell Development Guide\n\n## Core Philosophy\n\n1. **Types are the design** — Make illegal states unrepresentable. If the type checker accepts it, we would like it to be correct.\n2. **Purity by default** — Side effects are explicit in the type system. `IO` is a feature, not a burden.\n3. **Composition over inheritance** — Small, composable functions. Typeclasses for ad-hoc polymorphism.\n4. **Laziness as a tool** — Enables elegant abstractions but demands awareness of space leaks.\n5. **Correctness first, then performance** — Get it right, then profile, then optimize.\n5. **Keep it Simple** — Purity and strong types (i.e. roughly Haskell2010) gives you the majority of Haskell's value.  Avoid more advanced language features unless absolutely necessary.\n\n## Project Setup\n\n### Cabal (preferred with Nix)\n\n```bash\nmkdir my-project && cd my-project\ncabal init --interactive\n```\n\nMinimal `my-project.cabal`:\n```cabal\ncabal-version: 3.0\nname:          my-project\nversion:       0.1.0.0\nbuild-type:    Simple\n\ncommon warnings\n    ghc-options: -Wall -Werror -Wcompat -Widentities\n                 -Wincomplete-record-updates\n                 -Wincomplete-uni-patterns\n                 -Wpartial-fields\n                 -Wredundant-constraints\n\nlibrary\n    import:           warnings\n    exposed-modules:  MyProject\n    build-depends:    base >= 4.17 && \u003C 5\n                    , text\n                    , containers\n                    , aeson\n    hs-source-dirs:   src\n    default-language:  Haskell2010\n    default-extensions:\n        DeriveGeneric\n        DerivingStrategies\n        LambdaCase\n        ScopedTypeVariables\n\nexecutable my-project\n    import:           warnings\n    main-is:          Main.hs\n    build-depends:    base, my-project\n    hs-source-dirs:   app\n    default-language: Haskell2010\n\ntest-suite tests\n    import:           warnings\n    type:             exitcode-stdio-1.0\n    main-is:          Main.hs\n    build-depends:    base, my-project, hspec, QuickCheck\n    hs-source-dirs:   test\n    default-language: Haskell2010\n```\n\n## Project Structure\n\n```\nmy-project\u002F\n├── exe\u002F\n│   └── Main.hs              # Executable entry point (thin — delegates to library)\n├── src\u002F\n│   ├── MyProject.hs          # Public API (re-exports)\n│   ├── MyProject\u002F\n│   │   ├── Types.hs          # Core domain types\n│   │   ├── App.hs            # Application monad, config\n│   │   ├── DB.hs             # Database layer\n│   │   ├── API.hs            # HTTP\u002FAPI layer\n│   │   └── Internal\u002F         # Not exported — implementation details\n│   │       └── Utils.hs\n├── test\u002F\n│   ├── Main.hs\n│   └── MyProject\u002F\n│       ├── TypesSpec.hs\n│       └── DBSpec.hs\n├── my-project.cabal\n├── cabal.project             # Multi-package config, source-repository-packages\n```\n\n## Essential GHC Extensions\n\n### Always Enable (via `default-extensions` in .cabal)\n```haskell\nDeriveGeneric           -- Derives Generic\nDerivingStrategies      -- Explicit: deriving stock, newtype, anyclass, via\nLambdaCase              -- \\case { ... } instead of \\x -> case x of ...\nScopedTypeVariables     -- forall a. ... lets you reference 'a' in where clauses\n```\n\n### Use Freely When Needed\n```haskell\nBangPatterns\nDeriveDataTypeable\nDeriveFunctor\nDeriveGeneric               -- Generic instances for aeson, etc.\nDerivingVia                 -- Derive via newtype coercion\nDuplicateRecordFields       -- Same field name in different records\nExistentialQuantification   -- Hide type variables\nFlexibleContexts            -- Relax context restrictions\nFlexibleInstances           -- Relax instance head restrictions\nFunctionalDependencies      -- fundeps for MPTC\nGeneralizedNewtypeDeriving  -- Derive through newtypes\nMultiParamTypeClasses       -- Typeclasses with multiple params\nNumericUnderscores          -- More readable number syntax\nOverloadedRecordDot         -- record.field syntax (GHC 9.2+)\nOverloadedStrings           -- String literals as Text\u002FByteString\nRankNTypes                  -- Higher-rank polymorphism (forall inside arrows)\nRecordWildCards             -- Controversial but can be used effectively\n```\n\n### Avoid unless there's a significant clear value\n```haskell\nTemplateHaskell         -- Metaprogramming (aeson TH, lens TH). Slows compilation.\nGADTs                   -- Generalized algebraic data types\nTypeFamilies            -- Type-level functions\nDataKinds               -- Promote data constructors to types\nConstraintKinds         -- Alias constraint sets\nUndecidableInstances    -- Sometimes needed for MTL\u002Ftype families. Understand why.\nTypeOperators           -- type a :+: b. Servant uses heavily.\nAllowAmbiguousTypes     -- Pair with TypeApplications for type-level dispatch.\n```\n\n## Type-Driven Development\n\n### Scope accessors with type name to avoid name clashes\n\n```\ndata User = User\n  { _user_firstName :: String\n  , _user_email :: String\n  } deriving (Eq,Ord,Show,Read,Generic)\n```\n\n### Make Illegal States Unrepresentable\n```haskell\n-- BAD: stringly-typed\ndata User = User { _user_role :: String, _user_email :: String }\n\n-- GOOD: types encode constraints\ndata Role = Admin | Editor | Viewer\n  deriving stock (Show, Eq, Ord)\n\nnewtype Email = Email { _unEmail :: Text }  -- smart constructor validates\n\nmkEmail :: Text -> Either EmailError Email\nmkEmail t\n  | \"@\" `T.isInfixOf` t = Right (Email t)\n  | otherwise = Left InvalidEmail\n\ndata User = User\n  { _user_role  :: !Role\n  , _user_email :: !Email\n  }\n```\n\n### Phantom Types for State Machines\n```haskell\ndata Draft\ndata Published\n\ndata Article (s :: Type) = Article\n  { articleTitle   :: !Text\n  , articleContent :: !Text\n  }\n\npublish :: Article Draft -> Article Published\npublish (Article t c) = Article t c\n\n-- Only published articles can be shared\nshare :: Article Published -> IO ()\nshare = ...\n```\n\n### Newtypes for Safety\n```haskell\nnewtype UserId    = UserId    { unUserId    :: Int64 } deriving newtype (Eq, Ord, Show, FromJSON, ToJSON)\nnewtype ProductId = ProductId { unProductId :: Int64 } deriving newtype (Eq, Ord, Show, FromJSON, ToJSON)\n\n-- Now you can't accidentally pass a ProductId where UserId is expected\ngetUser :: UserId -> IO User\n```\n\n## Error Handling\n\n```haskell\n-- Pure errors: Either\nparseConfig :: Text -> Either ConfigError Config\n\n-- App-level errors: ExceptT or MonadError\nclass Monad m => MonadError e m where\n  throwError :: e -> m a\n  catchError :: m a -> (e -> m a) -> m a\n\n-- The ReaderT pattern (simple, composable)\nnewtype App a = App { unApp :: ReaderT AppEnv IO a }\n  deriving newtype (Functor, Applicative, Monad, MonadIO, MonadReader AppEnv)\n\ndata AppError\n  = NotFound Text\n  | Unauthorized\n  | ValidationError [Text]\n  deriving stock (Show)\n\n-- Throw with exceptions in IO, catch at boundaries\nthrowIO :: Exception e => e -> IO a\ncatch   :: Exception e => IO a -> (e -> IO a) -> IO a\n\n-- RULE: Use Either for expected failures, exceptions for unexpected\u002FIO failures.\n-- Never use error\u002Fundefined in library code.\n```\n\n## Common Patterns\n\n### The ReaderT Pattern\n```haskell\ndata AppEnv = AppEnv\n  { appDbPool   :: !Pool Connection\n  , appLogger   :: !Logger\n  , appConfig   :: !Config\n  }\n\nnewtype App a = App (ReaderT AppEnv IO a)\n  deriving newtype (Functor, Applicative, Monad, MonadIO, MonadReader AppEnv)\n\nrunApp :: AppEnv -> App a -> IO a\nrunApp env (App m) = runReaderT m env\n\n-- Use Has-pattern for granular access:\nclass Has field env where\n  obtain :: env -> field\n\ninstance Has (Pool Connection) AppEnv where\n  obtain = appDbPool\n\ngrabPool :: (MonadReader env m, Has (Pool Connection) env) => m (Pool Connection)\ngrabPool = asks obtain\n```\n\n### Optics (lens\u002Foptics)\n```haskell\n-- With OverloadedRecordDot (GHC 9.2+), often you don't need lens for simple access.\n-- Use lens\u002Foptics for: nested updates, traversals, prisms for sum types.\n\n-- lens: view, set, over\nview _1 (1, 2)       -- 1\nset _1 10 (1, 2)     -- (10, 2)\nover _1 (+1) (1, 2)  -- (2, 2)\n\n-- Compose with (.)\nview (config . database . host) appEnv\nover (users . each . name) T.toUpper myData\n```\n\n## Testing\n\n### HSpec - Testing Framework\n```haskell\n-- test\u002FMyProject\u002FTypesSpec.hs\nmodule MyProject.TypesSpec (spec) where\n\nimport Test.Hspec\nimport MyProject.Types\n\nspec :: Spec\nspec = do\n  describe \"mkEmail\" $ do\n    it \"accepts valid emails\" $\n      mkEmail \"user@example.com\" `shouldBe` Right (Email \"user@example.com\")\n\n    it \"rejects invalid emails\" $\n      mkEmail \"invalid\" `shouldSatisfy` isLeft\n```\n\n### QuickCheck - Property Testing\n```haskell\nimport Test.QuickCheck\n\nprop_reverseReverse :: [Int] -> Bool\nprop_reverseReverse xs = reverse (reverse xs) == xs\n\n-- Generate domain types:\ninstance Arbitrary Email where\n  arbitrary = do\n    user   \u003C- listOf1 (elements ['a'..'z'])\n    domain \u003C- listOf1 (elements ['a'..'z'])\n    pure $ Email $ T.pack $ user \u003C> \"@\" \u003C> domain \u003C> \".com\"\n```\n\n## Performance Essentials\n\n### Strictness\n```haskell\n-- Strict fields in data types (almost always want this):\ndata Config = Config\n  { configHost :: !Text       -- strict (bang pattern in field)\n  , configPort :: !Int\n  }\n\n-- BangPatterns in let bindings:\n{-# LANGUAGE BangPatterns #-}\nlet !result = expensiveComputation\n\n-- Use Text, not String. Always.\n-- Use ByteString for binary data.\n-- Use Vector for indexed access, [] for sequential processing.\n-- Use HashMap\u002FHashSet for large unordered collections.\n-- Use Map\u002FSet for ordered collections or when Ord is available.\n```\n\n### Profiling\n```bash\n# Build with profiling\ncabal build --enable-profiling\n\n# Run with heap profiling\n.\u002Fmy-project +RTS -hc -p -RTS\n\n# Time profiling report\n.\u002Fmy-project +RTS -p -RTS\n# Generates my-project.prof\n\n# Heap profile visualization\nhp2ps -c my-project.hp\n```\n\n### Common Space Leaks\n```haskell\n-- BAD: lazy accumulator\nfoldl (+) 0 [1..1000000]  -- builds giant thunk chain\n\n-- GOOD: strict left fold\nfoldl' (+) 0 [1..1000000]  -- evaluates as it goes\n\n-- BAD: lazy state\nmodify (\\s -> s { count = count s + 1 })  -- thunk builds up\n\n-- GOOD: strict state\nmodify' (\\s -> s { count = count s + 1 })\n-- Or: use strict fields + evaluate\n```\n\n## Commands Reference\n\n| Task | Command |\n|------|---------|\n| Build | `cabal build` |\n| Run | `cabal run my-project` |\n| Test | `cabal test --test-show-details=direct` |\n| REPL | `cabal repl` |\n| Docs | `cabal haddock` |\n| Lint | `hlint src\u002F` |\n| File watch | `ghcid --command=\"cabal repl\"` |\n| Deps outdated | `cabal outdated` |\n| Clean | `cabal clean` |\n| Nix build | `nix build` |\n| Nix dev shell | `nix develop` |\n\n## Common Gotchas\n\n1. **String is [Char]** — Use `Text` (from `text` package) everywhere. Enable `OverloadedStrings` for Text string literals.\n2. **Lazy IO** — `readFile` from Prelude is lazy. Use `Data.Text.IO.readFile` or `ByteString.readFile` instead.\n3. **Orphan instances** — Don't define typeclass instances outside the module that defines the type or the class. Use newtypes to wrap.\n4. **Cabal hell** — Use Nix or cabal's built-in solver (v2-build). Don't use `cabal-install` v1 commands.\n5. **Records** — Field names are global. Prefix field names with a uniform and readable scheme: `_employee_familyName`.\n6. **Partial functions** — Never use `head`, `tail`, `fromJust`, `read` in production code. Use pattern matching or safe alternatives.\n7. **Unsafe operations** - Never use `accursedUnutterablePerformIO`. Only use `unsafePerformIO` when you can prove its use correct.\n8. **Undefined** - `undefined` is a fantastic tool for stubbing things out for incremental development and type checking.  It should never exist in production code.\n9. **foldl vs foldl'** — Always use `foldl'` (strict). The lazy `foldl` from Prelude is almost never what you want.\n10. **Show for serialization** — `Show` is for debugging. Use `aeson` for JSON, `binary`\u002F`cereal` for binary serialization.\n11. **MonadFail** — Pattern match failures in `do` blocks require `MonadFail`. Avoid partial patterns in `do`.\n12. **Template Haskell ordering** — TH splices create declaration groups. All TH splices must come after the declarations they reference and before declarations that reference the generated code.\n\n## Key Libraries\n\n| Library | Purpose |\n|---------|---------|\n| `text` | Unicode text (strict & lazy) |\n| `bytestring` | Binary data |\n| `aeson` | JSON encoding\u002Fdecoding |\n| `postgresql-simple`, `mysql-simple` | Low-level database library |\n| `lens` \u002F `optics` | Composable getters\u002Fsetters |\n| `mtl` | Monad transformer classes |\n| `containers` | Map, Set, Seq (ordered) |\n| `unordered-containers` | HashMap, HashSet (fast) |\n| `vector` | Efficient arrays |\n| `conduit` \u002F `streaming` | Streaming data processing |\n| `warp` | Fast HTTP server |\n| `http-client` | Library for making http requests |\n| `stm` | Software transactional memory |\n| `QuickCheck` | Property-based testing |\n| `hspec` | BDD-style test framework |\n| `tasty` | Test framework (composable) |\n| `criterion` | Benchmarking |\n| `optparse-applicative` | CLI argument parsing |\n| `katip` | Structured logging |\n| `fake` | Generating realistic mock data |\n\n## References\n\nFor detailed information, see:\n- `references\u002Ftype-system.md` — ADTs, GADTs, type families, type classes, DataKinds, phantom types\n- `references\u002Fcommon-patterns.md` — MTL, ReaderT, effect systems, optics, free monads, type-level programming\n- `references\u002Flibraries.md` — Essential library ecosystem with examples\n- `references\u002Fperformance.md` — Strictness, profiling, space leaks, concurrency, benchmarking\n- `references\u002Fghc-extensions.md` — Comprehensive GHC extension guide by category\n- `references\u002Fnix-haskell.md` — Nix-based Haskell development (nixpkgs + haskell.nix)\n- `references\u002Fcabal-guide.md` — Cabal format, multi-package projects, Hackage publishing\n- `references\u002Fbest-practices.md` — Code organization, Haddock, CI, style guide\n",{"name":5,"description":7},"main","f9d3fe7cf9ac8f1ea63a0d96e98e1f510a3814db","skills\u002Fmightybyte\u002Fhaskell",1,"https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills","https:\u002F\u002Fgithub.com\u002Fjavimosch","intrane.fr","Building robust, open-source infrastructure for the commons. AI-leveraged, self-hosted, built to last.","2026-06-07 03:34:58",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add javimosch\u002Fopen-claw-skills --skill haskell",{"tool":39,"command":40},"bunx","bunx skills add javimosch\u002Fopen-claw-skills --skill haskell",{"tool":42,"command":43},"pnpm","pnpm dlx skills add javimosch\u002Fopen-claw-skills --skill haskell","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fmightybyte\u002Fhaskell\u002FSKILL.md",true,[],[48,56,63,70,77,84],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":55},"01M778GGXG2VQ0YF31W2MKGMQZ","crowd-prompting","A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzzadrian\u002Fcrowd-prompting\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":55},"01M778G7BH8SBJ9FJ6C3G7CB1K","ceaser","Interact with the Ceaser privacy protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- shield, unshield, note management, and protocol queries. All ceaser tool calls use CLI subcommands (npx -y ceaser-mcp \u003Csubcommand>). Ceaser is a privacy-preserving ETH wrapper using Noir\u002FUltraHonk zero-knowledge proofs on Base L2 (chain ID 8453).","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyra-v21\u002Fceaser\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":55},"01M778FYCJQZWFKKX5FYMK3S47","ceaser-send","Fully automated private ETH transfer via Ceaser Protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- all ceaser tool calls use CLI subcommands (npx -y ceaser-mcp \u003Csubcommand>). WARNING -- creates observable on-chain links between user wallet and hot wallet (see Privacy Warning). Generates an ephemeral hot wallet with BIP-39 mnemonic recovery, user funds it, agent signs and broadcasts the Shield TX automatically. Exactly one manual step required (funding the hot wallet with ETH). Uses Noir\u002FUltraHonk zero-knowledge proofs.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyra-v21\u002Fceaser-send\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":55},"01M778FQQNSEYA3HJKZBPQ4M9Z","dilemm-ai","Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyori\u002Fdilemm-ai\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":55},"01M778FGVZX7QA2TF9BFMM37FY","moldium","Post and manage content on the Moldium blog platform. Triggered by \"post to Moldium\", \"write a blog post\", \"publish an article\", etc.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyom45\u002Fmoldium\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":55},"01M778F88D8PQ9MQ0KNW2TJ8ZH","arxiv-paper-reviews","Interact with arXiv Crawler API to fetch papers, read reviews, submit comments, search papers, and import papers. Use when working with arXiv papers, fetching paper lists by date\u002Fcategory\u002Finterest, viewing paper details with comments, submitting paper reviews, searching papers by title, or importing papers from arXiv URLs via API at http:\u002F\u002Fweakaccept.top:8000\u002F.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Farxiv-paper-reviews\u002FSKILL.md",[],[]]