Skip to content

Instantly share code, notes, and snippets.

View jkachmar's full-sized avatar
🏳️‍⚧️

jkachmar jkachmar

🏳️‍⚧️
View GitHub Profile
module Main where
import Control.Monad.Trans.Writer.Ref
import qualified Control.Monad.Writer.CPS as CPS
import Control.Monad.ST
import Data.Foldable (for_)
import Data.Monoid
import Data.Semigroup
import Data.Mutable
import qualified Data.Vector.Generic.Mutable as M
@jkachmar
jkachmar / Servant.Ekg.hs
Created January 26, 2018 22:23
Servant EKG 0.12
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE PolyKinds #-}
@jkachmar
jkachmar / Main.purs
Last active June 3, 2020 18:18
Some Weird PureScript Validation Stuff
module Main where
import Prelude
import Control.Monad.Eff as Eff
import Control.Monad.Eff.Console as Eff.Console
import Semigroup as Semigroup
import Semiring as Semiring
main :: ∀ eff. Eff.Eff (console :: Eff.Console.CONSOLE | eff) Unit
module ServantAuthGoogle where
import ClassyPrelude hiding (Handler)
import Control.Error.Util (hush)
import Control.Lens ((.~), (^.), (^?))
import Control.Monad.Except
import qualified Crypto.JOSE as Jose
import qualified Crypto.JWT as Jose
import Crypto.Util (constTimeEq)
import Data.Aeson
@jkachmar
jkachmar / Main.hs
Last active March 17, 2020 15:55
Just Do the Right Thing
module Main where
--------------------------------------------------------------------------------
-- | This is the `Maybe` data type:
-- |
-- | > data Maybe a
-- | > = Nothing
-- | > | Just a
-- |
-- | `Maybe` is a sum type that can be parameterized over a given `a` type, such
module Chuckles where
import ClassyPrelude hiding (bool)
import Control.Category
import qualified Generics.SOP as SOP
import qualified GHC.Generics as G
import Squeal.PostgreSQL
type Schema =
@jkachmar
jkachmar / Example.hs
Last active October 5, 2023 21:11
UUID as Primary Key in Persistent
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Example where
@jkachmar
jkachmar / DumbThing.purs
Last active June 27, 2017 23:25
My Dumb PureScript Thing
module Main where
import Prelude
import Control.Monad.Aff (Aff, launchAff)
import Control.Monad.Aff.AVar (AVAR, AVar, makeVar', putVar, takeVar)
import Control.Monad.Aff.Class (class MonadAff, liftAff)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Class (liftEff)
import Control.Monad.Eff.Console (log)
@jkachmar
jkachmar / AuthTest.hs
Last active June 14, 2017 20:51
Tasty Scaffold
module Handler.AuthTest where
-- * Prelude.
import ClassyPrelude
-- * Database imports.
import Database.Persist
import Database.Persist.Sql
-- * Testing imports.
@jkachmar
jkachmar / main.c
Created May 3, 2017 14:42
Mongoose OS WDT Reset Repro
#include <stdio.h>
#include "common/cs_dbg.h"
#include "common/platform.h"
#include "frozen/frozen.h"
#include "fw/src/mgos_app.h"
#include "fw/src/mgos_adc.h"
#include "fw/src/mgos_aws_shadow.h"
#include "fw/src/mgos_gpio.h"