Skip to content

Instantly share code, notes, and snippets.

import java.util.Arrays;
public class InterfaceOverload {
private interface I<X, IWitness extends I<?, IWitness>> { }
private interface J<X, JWitness extends J<?, JWitness>> { }
private interface K<X, KWitness extends K<?, KWitness>> { }
private interface L<X, LWitness extends L<?, LWitness>> { }
private interface M<X, MWitness extends M<?, MWitness>> { }
private interface N<X, MWitness extends N<?, MWitness>> { }
module NonTotalVerifiedComonad
%default total
interface Functor w => Comonad (w : Type -> Type) where
extract : w a -> a
extend : (w a -> b) -> w a -> w b
extend f = map f . duplicate
@nomicflux
nomicflux / fish-prompt.sh
Created February 23, 2017 17:03 — forked from gak/fish-prompt.sh
My custom fish prompt code explained at http://geraldkaszuba.com/tweaking-fish-shell/
function _common_section
printf $c1
printf $argv[1]
printf $c0
printf ":"
printf $c2
printf $argv[2]
printf $argv[3]
printf $c0
printf ", "
object NoLinebreaks extends RegexParsers {
override def skipWhitespace = false
def anyChar: Parser[String] = """.""".r
def apply(input: String) = parse(anyChar, input)
}
\**
* scala> NoLinebreaks("a")
* res135: NoLinebreaks.ParseResult[String] = [1.2] parsed: a
*
module Queue
import Data.Vect as V
%access export
data Queue : Type -> Nat -> Nat -> Nat -> Type where
mkQueue : (front : V.Vect n ty)
-> (back : V.Vect m ty)
-> Queue ty n m (n + m)
add : Int -> Int -> Int
add x y = x + y
doSomething : (Int -> Int -> Int) -> Int -> Int -> Int
doSomething f x y = f x y
doSomething add 1 2 -- Result: 3
module Main
data DoorState = DoorClosed | DoorOpen
data DoorResult = OK | Jammed
doorResult : DoorResult -> DoorState
doorResult = \res => case res of
OK => DoorOpen
Jammed => DoorClosed
module Main
data DoorState = DoorClosed | DoorOpen
data DoorResult = OK | Jammed
doorResult : DoorResult -> DoorState
doorResult = \res => case res of
OK => DoorOpen
Jammed => DoorClosed
2016-11-09 19:33:42 crash_report
initial_call: {kernel_config,init,['Argument__1']}
pid: <0.59.0>
registered_name: []
error_info: {exit,{mandatory_nodes_down,['b@MacBook-Air-2','c@MacBook-Air-2']},[{gen_server,init_it,6,[{file,"gen_server.erl"},{line,344}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
ancestors: [kernel_sup,<0.34.0>]
messages: [{'EXIT',<0.60.0>,normal}]
links: [<0.35.0>]
dictionary: []
trap_exit: true
@nomicflux
nomicflux / pp-comonad.hs
Created November 1, 2016 01:50 — forked from jtobin/pp-comonad.hs
Probabilistic programming using comonads.
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
import Control.Comonad
import Control.Comonad.Cofree
import Control.Monad
import Control.Monad.ST