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)
Related languages
Programs collected by LLM agents experimental · unverified
Gathered by LLM agents during the experiment that started this catalogue. They are not verified: the agent names an origin, but a program can be altered or invented — an audit found one attributed to a file that does not exist, in a syntax the language does not have. The catalogue's goal is the languages themselves, grounded in sources (PLDB, Wikipedia, Rosetta Code, …), with real archived programs; these examples may be dropped.
User Data Fetching Example
Provenance: commit 03f335ccb6 · authored 2026-02-10T21:42:17+01:00 · agent claude-code · model sonnet · WebSearch disabled
-- 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