Skip to content

Instantly share code, notes, and snippets.

Jyri-Matti Lähteenmäki jyrimatti

View GitHub Profile
View Main.hs
#! /usr/bin/env nix-shell
#! nix-shell -i runghc -p "haskellPackages.ghcWithPackages(p: with p; [type-level-sets])"
#! nix-shell -I nixpkgs=channel:nixos-18.03
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
@jyrimatti
jyrimatti / oip.hs
Last active Oct 6, 2016
Optics in Programming (https://lahteenmaki.net/dev_*16/) - code. Executable file. Or paste to Haskell-for-Mac.
View oip.hs
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p "haskellPackages.ghcWithPackages(p: with p; [profunctors mtl lens])"
ghci <<---EOF
:set +m
:set -XRank2Types
:set -XScopedTypeVariables
{-# LANGUAGE Rank2Types, ScopedTypeVariables #-}
import Data.Tuple (swap)
import Data.Monoid (First(..), getFirst, (<>))
View gist:76be5db28fd652822a6b77978a7624a0
Verifying that +jyrimatti is my blockchain ID. https://onename.com/jyrimatti
View keybase.md

Keybase proof

I hereby claim:

  • I am jyrimatti on github.
  • I am jyrimatti (https://keybase.io/jyrimatti) on keybase.
  • I have a public key whose fingerprint is 38E6 FC6A C104 7CEC 71CE 71E7 1959 B8A4 F22F EC94

To claim this, I am signing this object:

View Main.hs
{-# LANGUAGE TupleSections #-}
module Main where
-- hide the-dot to use it from Control.Category
import Prelude hiding ((.))
import Control.Category
import Control.Monad ((<=<))
import Control.Comonad.Env
import Control.Arrow
import Data.Profunctor
@jyrimatti
jyrimatti / Main.hs
Created Sep 22, 2015
Aeson example
View Main.hs
-- build with cabal file:
-- name: aeson-ex
-- version: 0.1
-- build-type: Simple
--
-- executable aeson_ex
-- hs-source-dirs: src
-- main-is: Main.hs
-- build-depends: base >= 4,
@jyrimatti
jyrimatti / gist:89a6313692d47b4a3225
Created Aug 29, 2015
My public key fingerprint
View gist:89a6313692d47b4a3225
38E6 FC6A C104 7CEC 71CE 71E7 1959 B8A4 F22F EC94
View gist:3868667
// These should already exist in a standard library or similar
trait Showable[T] {
val show: T => String
}
trait StandardShowables {
implicit object StringIsShowable extends Showable[String] {
val show = (a: String) => a
}
implicit object BooleanIsShowable extends Showable[Boolean] {
val show = (a: Boolean) => a.toString
You can’t perform that action at this time.