Skip to content

Instantly share code, notes, and snippets.

@Solonarv
Solonarv / A.hs
Created February 4, 2016 01:15
Sample GHC Core output when dealing with multiple classes
module A where
class Foo a where foo :: a -> String
instance Show a => Foo [a] where foo = ($ "") . showList
@Solonarv
Solonarv / Show-transformed.hs
Created February 5, 2016 17:51
Transformation exposing typeclass dictionaries
data FooDict a = FooDict {
foo :: a -> Int
bar :: a -> [()]
}
/h/constraint-witness/plugin (master)
$ ghc ConstraintWitness.Test
[5 of 5] Compiling ConstraintWitness.Test ( ConstraintWitness\Test.hs, ConstraintWitness\Test.o )
ConstraintWitness\Test.hs:15:9:
Couldn't match type `(:~:) a' with `Int :~: a'
Expected type: Witness (Int ~ a) -> Int :~: a
Actual type: Int :~: a -> Int :~: a
Relevant bindings include
test1 :: Witness (Int ~ a) -> Int :~: a

Setting: Eberon

General setting

Humanity in strange state

  • besieged
  • in the past: humanity had to build an underground city, Sharraat, to protect itself from the Enemy.
  • Humanity is expanding again
  • dark mood
  • tech/culture level: 16th-17th ctry
  • Magic is common, but not commonplace
; Path of Exile macros
; go to hideout
$^h:: Send {Enter}/hideout{Enter}
; logout
$^l:: Send {Enter}/exit{Enter}
; attack-in-place
Capslock:: Send {LShift Down}
#-*-coding:utf8;-*-
#qpy:3
#qpy:console
from random import randint
def bin(n, width):
return blockify(("{:0"+str(width)+"b}").format(n))
def blockify(s):
"Talents"
{
"10"
{
"left" "talent_1"
"right" "talent_2"
}
"15"
{
"left" "talent_3"
flicker_rapid_strike = class({})
LinkLuaModifier("modifier_rapid_strike", "heroes/hero_flicker/modifier_rapid_strike.lua", LUA_MODIFIER_MOTION_NONE)
function flicker_rapid_strike:OnSpellStart()
local target = self:GetCursorTarget()
self:GetCaster().rapid_strike_target = target
self:GetCaster():AddNewModifier(self:GetCaster(), self, "modifier_rapid_strike", {})
end
public class Main {
static Output out = new Output();
public static void main(String[] args)
{
System.out.println(out.Shannon);
}
}
public class Constants {
public static final double PI = 3.14159; // should have more digits, obviously
public static final double PHI = (Math.sqrt(5) - 1) / 2; // Exact value, or as close as we can get
public static final int ANSWER = 42; // or is it?
public static final int NUMBER_OF_GENDERS = Double.POSITIVE_INFINITY; // ;)