Skip to content

Instantly share code, notes, and snippets.

module Main where
--------------------------------------------------------------------------------
import Data.Distributive
import Data.Foldable
import Data.Functor.Rep
import Data.Machine.Moore
import Control.Comonad.Cofree
module LensStore where
import Control.Comonad
import Control.Comonad.Store
type Coalg s a = s -> Store a s
_1 :: (a, b) -> Store a (a, b)
_1 (a, b) = store set get
where
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE RecordWildCards #-}
module FingerTrees where
import Control.Lens hiding (Empty, (<|), (|>), deep)
import Data.Foldable (fold)
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DeriveFunctor #-}
-- | Extract the descriptions from a SpecWith
module SpecExtract where
--------------------------------------------------------------------------------
import Test.Hspec
import Test.QuickCheck
import Control.Exception (evaluate)
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE TypeFamilyDependencies #-}
module TreesThatGrow where
import Data.Void
import Data.Kind
import Data.Profunctor
------------
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
module FreerMonadFx where
import Data.Bifunctor (first)
import Data.Functor.Sum
import Data.Functor.Coyoneda
import Control.Monad
import Control.Monad.Free
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ViewPatterns #-}
-- |
module NestHydration where
import Control.Lens
import Data.Map (Map)
import Data.Map.Strict qualified as Map
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
-- |
module RealWorld where
--------------------------------------------------------------------------------
import GHC.Prim
import GHC.Types
import GHC.ST
@solomon-b
solomon-b / FreeMonadFx.hs
Created September 18, 2024 22:36
Free Monad Effects example
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
module FreeMonadFx where
import Data.Functor.Sum
import Control.Monad
import Control.Monad.Except
import Control.Monad.Free
import Control.Monad.State
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DeriveFunctor #-}
module RecursionSchemes where
--------------------------------------------------------------------------------
import Data.Smash
import Data.Function ((&))
import Data.Bifunctor