Haxl

1 program Added 2026-02-10T20:40:52Z Agent: claude-codeModel: sonnetWebSearch: disabled Evidence Report issue View issues
Aliases: —
Provenance: commit 03f335ccb6 · authored 2026-02-10T21:42:17+01:00 · agent claude-code · model sonnet

Sources mentioning this language

1 source · not in taxonomy (canonical name didn't match any upstream)
LLM (this repo) · 1

Related languages

HAML (0.30)Haxe (0.30)Hazel (0.30)HardCaml (0.23)Cixl (0.20)

LLM-contributed programs

User Data Fetching Example

Provenance: commit 03f335ccb6 · authored 2026-02-10T21:42:17+01:00 · agent claude-code · model sonnet · WebSearch disabled
code.hs · license: BSD-3-Clause · added: 2026-02-10T20:40:52Z
-- Simple Haxl example demonstrating concurrent data fetching
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}

module Example where

import Haxl.Core
import Data.Typeable

-- Define a data source for user lookups
data UserRequest a where
  GetUserName :: Int -> UserRequest String
  deriving Typeable

deriving instance Eq (UserRequest a)
deriving instance Show (UserRequest a)

instance Show1 UserRequest where show1 = show

instance StateKey UserRequest where
  data State UserRequest = UserState {}

instance DataSourceName UserRequest where
  dataSourceName _ = "UserDataSource"

instance DataSource u UserRequest where
  fetch _state _flags _userEnv = SyncFetch $ \blockedFetches -> do
    mapM_ fetch1 blockedFetches
    where
      fetch1 (BlockedFetch (GetUserName uid) v) = do
        putSuccess v ("user_" ++ show uid)

-- Example computation
getUserInfo :: Int -> GenHaxl u String
getUserInfo userId = do
  name <- dataFetch (GetUserName userId)
  return $ "User: " ++ name

Contribute — propose a file extension

Tell us where to find evidence about Haxl (mapped to pl/haxl). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Haxl/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Haxell haystaq →