Skip to content

Instantly share code, notes, and snippets.

@timelyportfolio
timelyportfolio / jgb data.r
Created October 16, 2012 21:49
japanese governement bond jgb historical data
#get Japan yield data from the Ministry of Finance Japan
#data goes back to 1974
require(latticeExtra)
require(xtsExtra)
url <- "http://www.mof.go.jp/english/jgbs/reference/interest_rate/"
filenames <- paste("jgbcme",c("","_2010","_2000-2009","_1990-1999","_1980-1989","_1974-1979"),".csv",sep="")
#load all data and combine into one jgb data.frame
@tonyday567
tonyday567 / emitter.hs
Last active December 22, 2015 04:48
emitter random walk plus stop/go effect
{-# LANGUAGE RankNTypes #-}
{-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-unused-do-bind -fno-warn-unused-imports -fno-warn-orphans #-}
--
-- Random walk emitter with go and stop button
--
module Main where
import Control.Applicative
@mbostock
mbostock / .block
Last active February 9, 2016 01:04 — forked from mbostock/.block
Irregular Histogram
license: gpl-3.0
{-# language DataKinds, PolyKinds, ScopedTypeVariables, UndecidableInstances,
FlexibleInstances, FlexibleContexts, GADTs, TypeFamilies, RankNTypes,
LambdaCase, TypeOperators, ConstraintKinds #-}
import GHC.TypeLits
import Data.Proxy
import Data.Singletons.Prelude
import Data.Singletons.Decide
import Data.Constraint
@reetinder
reetinder / haskell-org.el
Created November 6, 2012 06:30
Literate Haskell with Org Mode Documentation
;;; haskell-org.el --- Literate Haskell with Org Mode Documentation
;; Copyright (C) 2003, 2007 Free Software Foundation, Inc.
;; Authors: Dave Love <fx@gnu.org>
;; Keywords: languages, wp
;; Created: Sept 2003
;; $Revision: 1.5 $
;; URL: http://www.loveshack.ukfsn.org/emacs
;; Modified by Reetinder Sidhu on oct. 30, 2012 for org-mode support.
@Icelandjack
Icelandjack / blog_deriving.markdown
Last active October 7, 2019 22:43
Blog Post: Derive instances of representationally equal types

Reddit discusson thread.

I made a way to get more free stuff and free stuff is good.

The current implementation of deriveVia is here, it works with all the examples here. Needs GHC 8.2 and th-desugar.

It doesn't take long

for new Haskellers to get pampered by their compiler. For the price of a line or two the compiler offers to do your job, to write uninteresting code for you (in the form of type classes) such as equality, comparison, serialization, ... in the case of 3-D vectors

@Icelandjack
Icelandjack / OpenKinds.markdown
Last active January 26, 2020 20:53
Rethinking Tricky Classes: Explicit Witnesses of Monoid Actions, Semigroup / Monoid / Applicative homomorphisms
@dysinger
dysinger / packages.el
Last active January 16, 2021 19:30
Private spacemacs layer to try out Chris Done's Intero mode for haskell
;; 1. place this in ~/.emacs.d/private/intero/packages.el
;; 2. add intero, syntax-checking and auto-completion to your
;; ~/.spacemacs layer configuration & remove the haskell layer
;; if you were using that before
;; 3. make sure you have stack installed http://haskellstack.org
;; 4. fire up emacs & open up a stack project's source files
@TikhonJelvis
TikhonJelvis / cabal-schema.json
Created August 30, 2021 00:41
A nowhere-near complete or correct JSON Schema for Cabal package descriptions
{
"title": "Cabal file",
"type": "object",
"properties": {
"license-files": {
"description": "One or more files containing the precise copyright license for the package.",
"items": {
"type": "string"
},
"type": "array"
@sjoerdvisscher
sjoerdvisscher / nucleus.hs
Last active September 25, 2021 06:36
Nucleus of a profunctor
{-# LANGUAGE
PolyKinds
, RankNTypes
, TypeFamilies
, TypeOperators
, TypeApplications
, FlexibleInstances
, ScopedTypeVariables
, AllowAmbiguousTypes
, MultiParamTypeClasses