Skip to content

Instantly share code, notes, and snippets.

@oleks
oleks / gist:a0b8c128d12109ca413cedc5da6e3473
Created November 13, 2018 11:46
stack new on my current nixos
$ stack --nix new hello-world -p "category:Compilers/Interpreters"
Downloading template "new-template" to create project "hello-world" in hello-world/ ...
Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- hello-world/
Selecting the best among 14 snapshots...
Unable to load cabal files for snapshot
// K&R style (according to Rider)
if (condition) {
foo();
}
else {
foo();
}
// One true brace style (1TB)
if (condition) {
@oleks
oleks / gist:79ced969f38fc193a17037d3bca44f69
Created November 7, 2017 17:20
Rider 2017.2 installation fails
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.ide.ClassUtilCore to field sun.net.www.protocol.jar.JarFileFactory.fileCache
WARNING: Please consider reporting this to the maintainers of com.intellij.ide.ClassUtilCore
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
ERROR: null
java.lang.reflect.InvocationTargetException
at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1328)
at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1303)
$ java --version
openjdk 9.0.0.15
OpenJDK Runtime Environment (Zulu build 9.0.0.15+181)
OpenJDK 64-Bit Server VM (Zulu build 9.0.0.15+181, mixed mode)
module Sample
import Data.Vect
import Data.SortedMap
X : (n : Nat) -> Type
X n = Vect n Nat
Y : Nat -> Nat -> Type
Y m n = Vect m (X n)
@oleks
oleks / A.idr
Last active April 16, 2017 21:27
Defining equality for a non-dependent type hosting a dependent type
module A
import Data.Vect
data T
= Val Int
| Vec (Vect len T)
vectEq : Eq a => Vect n a -> Vect m a -> Bool
vectEq {n} {m} v w = n == m && Just v == (exactLength n w)
@oleks
oleks / A.idr
Last active April 15, 2017 15:37
Using dependent types in regular types
module A
import Data.Vect
data T =
MkT (Vect len Int)
eq' : Vect n Int -> Vect m Int -> Bool
eq' {n} {m} v w = n == m && (exactLength n v) == (exactLength n w)
module Spaces
import Lightyear.Char
import Lightyear.Combinators
import Lightyear.Core
import Lightyear.Strings
toomany : Either String (List Char)
toomany = parse (many $ char ' ') " "
module Expr
data Expr = X
| Plus (Expr, Expr)
Show Expr where
show X = "x"
show (Plus (e_left, e_right)) = (show e_left) ++ " + " ++ (show e_right)
{-
@oleks
oleks / part1.md
Last active March 7, 2016 21:52
Notebook 1

Test