Skip to content

Instantly share code, notes, and snippets.

module Grammar where
import Prelude
import Control.Applicative.Free (FreeAp, liftFreeAp, foldFreeAp)
import Control.Alt (class Alt, (<|>))
import Control.Alternative (class Alternative)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (log, CONSOLE)
import Control.Plus (class Plus, empty)
@joneshf
joneshf / Main.purs
Created December 21, 2016 17:53 — forked from FrigoEU/Main.purs
Poly labels wih Fail instance
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log, logShow)
import Data.Newtype (class Newtype, unwrap)
import Data.Profunctor (dimap)
import Data.Profunctor.Strong (class Strong, second)
import Data.Tuple (Tuple(..), uncurry)
import Type.Proxy (Proxy(..))
@joneshf
joneshf / .gitignore
Last active August 10, 2016 01:53 — forked from dypsilon/reader-t.js
node_modules
@joneshf
joneshf / STM-FUNN.hs
Last active June 11, 2016 20:47 — forked from cartazio/STM-FUNN.hs
a little demo GHCI transcript illustrating STM and concurrency
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
Prelude> import Control.Concurrent.STM
Prelude Control.Concurrent.STM> vars <- atomically $ mapM (\ _ -> newTVar False) [1..10]
Prelude Control.Concurrent.STM> length vars
10
Prelude Control.Concurrent.STM> :t vars
vars :: [TVar Bool]
Prelude Control.Concurrent.STM> import Control.Concurrent as CC
Prelude Control.Concurrent.STM CC> CC.forkIO ( do x <- atomically (do { xs <- mapM readTVar vars ; if and xs then return True else retry } ) ; if x then putStrLn "wippeee" else putStrLn "wattt")
ThreadId 489
-- CIS 194 Homework 2
module Log where
import Control.Applicative
data MessageType = Info
| Warning
| Error Int
deriving (Show, Eq)
#!/usr/bin/ruby
def bottom_up(p, n)
r = Array.new(n,0)
(1..n).each do |j|
q = -1
(1..j).each do |i|
q = [q, r[j-i] +
@joneshf
joneshf / data.json
Last active December 22, 2015 08:09 — forked from viclib/gist:6441678
"perfis":{
"conservador":{
"renda_fixa":{
"percentuais":[70,65,60,55,50,45,40,35,30,25],
"divisao":{
"Renda Fixa Referenciado":100,
"Renda Fixa Índice":0
}
},
"multimercado":{