Skip to content

Instantly share code, notes, and snippets.

View assafi's full-sized avatar

Assaf Israel assafi

View GitHub Profile
@assafi
assafi / TryAction
Last active August 29, 2015 13:58
C# version of scala.util.Try - 2nd draft
using System;
namespace CSharpExtensions.Monads
{
public abstract class Try
{
public static Try Invoke(Action action)
{
try
{
@assafi
assafi / FileNameImpl.scala
Last active December 20, 2015 05:49
Check file name correctness during compilation using Scala interpolation / macros.
package utils
import scala.language.experimental.macros
import scala.reflect.macros.Context
object FileNameImpl {
def fileImpl(c: Context)(): c.Expr[String] = {
import c.universe._
val Apply(_, List(Apply(_, List(Literal(Constant(fileName: String)))))) = c.prefix.tree