Skip to content

Instantly share code, notes, and snippets.

View tomjaguarpaw's full-sized avatar

tomjaguarpaw

View GitHub Profile
{- cabal:
build-depends: base, bluefin
-}
{-# LANGUAGE GHC2021 #-}
import Bluefin.Eff (Eff, runPureEff, (:>))
import Bluefin.Stream (Stream, forEach, yield, yieldToList)
import Control.Monad (when)
import Data.Foldable (for_)
No 'hie.yaml' found. Try to discover the project type!
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper-2.10.0.0) Version 2.10.0.0 x86_64 ghc-9.10.1
Current directory: /home/tom/Haskell/bluefin
Operating system: linux
Arguments: ["--lsp","-d","-l","/tmp/hls.log"]
Cradle directory: /home/tom/Haskell/bluefin
Cradle type: Cabal
Tool versions found on the $PATH
cabal: 3.14.1.0
@tomjaguarpaw
tomjaguarpaw / bluefin.hs
Created December 26, 2025 09:28
Bluefin demand analyser
{-# LANGUAGE GHC2021 #-}
import Bluefin.Eff
import Bluefin.Exception
import Bluefin.IO
import Control.Exception hiding (Exception, catch, throw)
{-# NOINLINE f #-}
f :: Int -> Int -> IO Int
f x y
@tomjaguarpaw
tomjaguarpaw / addPoint.hs
Created January 5, 2024 09:32
addPoint product-profunctors
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
import Control.Applicative
import Data.Profunctor
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -Wall #-}
module Main where
import Control.Lens (makeLenses, use, (%=), (.=))
import Control.Monad (when)
import Control.Monad.Trans.State.Strict (evalState)
import Data.Traversable (for)
@tomjaguarpaw
tomjaguarpaw / StrangeHashable.hs
Last active May 28, 2020 17:13
Strange hashable
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE DeriveGeneric #-}
{-# OPTIONS_GHC -Wall #-}
module StrangeHashable where
import Data.Hashable
import GHC.Generics (Generic)
data ListF a r = ConsF a r | NilF deriving Generic
@tomjaguarpaw
tomjaguarpaw / dynamic-fields.hs
Last active September 21, 2019 17:11
Opaleye dynamic fields
-- Requires branch https://github.com/tomjaguarpaw/haskell-opaleye/tree/dynamic-fields
--
-- If you use this please contact me http://web.jaguarpaw.co.uk/~tom/contact/ and let me
-- know what you think.
import Data.String
import Opaleye
import Opaleye.Internal.Dynamic (SqlDynamic, Dynamic,
stringFromFields, stringUnpackspec)
@tomjaguarpaw
tomjaguarpaw / systems-theory-books.md
Last active August 19, 2019 15:10
Systems theory books
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
module Test2 where
data Proxy a = Proxy

stargazer

Structurally typed arguments and zero extra rubbish

-- Stargazer's, very small, API

-- An option can take a single string argument or nothing at all.
string  :: Schema String
nothing :: Schema ()