Skip to content

Instantly share code, notes, and snippets.

View jfdm's full-sized avatar

Jan de Muijnck-Hughes jfdm

View GitHub Profile
@jfdm
jfdm / main.ola
Last active October 16, 2022 19:35
Projection of Session Types in Ola (and we have a REPL)
role Alice
role Bob
type foo = String
protocol pingpong = Alice ==> Bob { ping(String)
. Bob ==> Alice { pong(String)
. end }}
main()
@jfdm
jfdm / Versioned.idr
Last active October 12, 2022 21:01
Indexing terms with versioning.
module Versioned
import Data.List.Elem
import Data.List.Quantifiers
import Data.Nat
%default total
data Ty
= TyNat
@jfdm
jfdm / FATA.idr
Created September 27, 2022 15:04
Short Introduction to Dependently Typed Programing in Idris given at FATA Seminars 22/23
||| #+TITLE: Dependently Typed Functional Programming
||| #+AUTHOR: Jan de Muijnck-Hughes
||| #+DATE: FATA Seminar 22/23
||| #+STARTUP: noindent overview
module FATA
%default total
-- # Abstract
@jfdm
jfdm / ConsNeg.idr
Created September 6, 2022 13:05
Adventures in being construcively negative.
module ConsNeg
import Data.Nat
%default total
namespace PosNeg
public export
data Truth : Type where
@jfdm
jfdm / Example.idr
Last active June 17, 2022 09:56
Not Quite Four but Hello World
module Example
import Ola
public export
example : Prog Nil Nil UNIT
example
= DefType TyStr
$ DefFunc (TyFunc TyUnit (TyVar Here))
(Fun (Return (S "Hello World")
@jfdm
jfdm / REPL.txt
Last active May 24, 2022 21:38
Types as (Abstract) Intepreters for HDLs and Graphs...
Idris 0.5.1-8bd5ca949
1/1: Building Temp (Temp.idr)
λΠ> fst (snd example)
G [3, 2, 1, 1, 2, 1, 3] [(2, 1), (3, 1)]
λΠ> example
MkDPair 3 (MkDPair (G [3, 2, 1, 1, 2, 1, 3] [(2, 1),
(3,
1)]) (Port LOGIC OUT (Port LOGIC IN (Port LOGIC IN (GDecl (Gate (Var (There (There Here))) (Var (There Here)) (Var Here)) Stop)))))
λΠ> :t example
@jfdm
jfdm / SomethingInteresting.txt
Created April 20, 2022 21:24
Something Something Something Type-Driven; Something Something Darkside; Something Something Complete
λΠ> show EmployeeSchema
"(Employee (PersonInfo ((FullName ((Firstname : String is not restricted) <+>
((Lastname : String is not restricted) <+> {}))) <+>
(((Address : String is not restricted)
<|>
((FirstLine : String is not restricted) <+>
((City : String is not restricted) <+>
((Country : String is restricted) <+>
((PostCode : String is not restricted) <+> {}))))) <+>
{}))))"
@jfdm
jfdm / Top.sv
Last active March 17, 2022 21:56
LightClick handling optional connections.
module a
(
output logic clk,
output logic rst
);
// TO ADD
endmodule;
module b
(
@jfdm
jfdm / Examples.idr
Created March 17, 2022 10:39
Different ways on doing Decidable Equality on a 'Simple' record type.
module Examples
import Decidable.Equality
data Foo = F String Nat
namespace Beginner
export
decEq : (x,y : Foo) -> Dec (x = y)
decEq (F xs xn) (F ys yn) with (decEq xs ys)
@jfdm
jfdm / example3.olaf
Created December 10, 2021 11:30
Reduction Sequence for Foldr In Olaf
def xs : (List Nat) :=
(extend 1
(extend 2
empty[Nat]))
def myAdd : (Nat -> (Nat -> Nat))
:= (fun x : Nat, y : Nat => (add x y))
def rec foldr : ((Nat -> (Nat -> Nat)) -> (Nat -> ((List Nat) -> Nat)))