Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am lunaris on github.
  • I am lunaris (https://keybase.io/lunaris) on keybase.
  • I have a public key whose fingerprint is CF44 492C AB27 A2FA 2AF1 191A 3D21 059F 23E6 7D8E

To claim this, I am signing this object:

@lunaris
lunaris / Via.hs
Last active December 16, 2020 09:57
Deriving via -- no more transformers
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Via where
@lunaris
lunaris / Redux.js
Created August 15, 2016 15:49
Redux bindings for PureScript
"use strict";
exports.baseStore = Redux.createStore.bind(Redux);
exports.getState = function getState(store) {
return store.getState();
};
exports.mkReducer = function mkReducer(actionDict) {
return function (f) {
@lunaris
lunaris / Maps.hs
Created August 2, 2016 14:28
Resolving trees with maps
module Maps where
import qualified Data.Maybe as Mb
import qualified Data.Map.Strict as M
data Plugin
= Plugin { pName :: String, pDependencies :: [String] }
deriving (Eq, Show)
plugins :: [Plugin]
Error found:
in module Test
at src/Test.purs line 57, column 7 - line 57, column 24
Could not match type
eff0
with type
"use strict";
// module Test
exports.someThingArbitrary = function someThingArbitrary(f) {
return f("yarp");
};
module Test where
import Control.Monad.Aff (Aff, runAff)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
import Prelude ((<>), bind, pure, unit)
type MonadA m
= { opA :: m String
}
@lunaris
lunaris / Authentication.hs
Created September 1, 2015 09:51
Authentication in Servant: Design space exploration
-- The idea: generalise authentication to session information which can be
-- extracted from (e.g.) the current request and a suitable monad 'm'. This
-- is currently problematic as no 'm' is exposed through the type class
-- head.
instance (HasServer sublayout)
=> HasServer (WithSession st :> sublayout) where
type ServerT (WithSession st :> sublayout) m
= MonadSessionWith st m => ServerT sublayout m
public abstract class Maybe<A> {
public abstract A Value { get; }
public abstract Maybe<B> Map<B>(Func<A, B> f);
private Maybe() { }
public static Maybe<A> nothing() {
return new Nothing();
}