This blog post series has moved here.
You might also be interested in the 2016 version.
package proxy | |
import language.dynamics | |
abstract class Param[T] { type Type } | |
object Param { | |
def apply[T](name: String) = new Param[name.type] { type Type = T } | |
} | |
class Proxy(underlying: Map[String, Any]) extends Dynamic { |
This blog post series has moved here.
You might also be interested in the 2016 version.
#include <utility> | |
#include <iostream> | |
struct void_ | |
{ | |
template<typename Stream> | |
friend Stream &operator<<(Stream &s, void_) | |
{ | |
return s << "()"; | |
} |
Basic unit type:
λ> replTy "()"
() :: ()
Basic functions:
{-# LANGUAGE GADTs #-} | |
module Yolo where | |
import System.IO.Unsafe | |
class Yolo f where | |
yolo :: f a -> a | |
instance Yolo Maybe where | |
yolo (Just x) = x |
module QueryTrace | |
def self.enable! | |
::ActiveRecord::LogSubscriber.send(:include, self) | |
end | |
def self.append_features(klass) | |
super | |
klass.class_eval do | |
unless method_defined?(:log_info_without_trace) | |
alias_method :log_info_without_trace, :sql |
role Group { | |
method elements { ... } | |
method id { ... } | |
method op($l, $r) { ... } | |
} | |
macro assert($fact) { | |
quasi { | |
die "FAILED: ", $fact.Str | |
unless {{{$fact}}}; |
#include <utility> | |
#include <vector> | |
#include <iostream> | |
#define ANY_OP(T, OP) bool operator OP(T el) { \ | |
for (const auto& elem : _elems) { \ | |
if (elem OP el) return true; \ | |
} \ | |
return false; \ | |
} |
require 'test_helper' | |
class AbilityTest < ActiveSupport::TestCase | |
def setup | |
super | |
@ability_t = Ability.new(users(:translator_my)) | |
@ability_m = Ability.new(users(:manager_my)) | |
@ability_a = Ability.new(users(:admin_my)) | |
@proj1 = projects(:proj1) |
use v6; | |
sub t ($x, $y, :$label = 'sum') { | |
say "$label: ", $x + $y; | |
} | |
sub namecall(&c, *@pos, *%named is rw) { | |
my %name-to-idx; | |
for &c.signature.params.kv -> $idx, $p { | |
next if $p.named; |