Skip to content

Instantly share code, notes, and snippets.

View tfi.md

Revisiting Tagless Final Interpreters with Dotty

Tageless Final interpreters are an alternative to the traditional Algebraic Data Type (and generalized ADT) based implementation of the interpreter pattern. This document presents the Tageless Final approach with Scala, and shows how Dotty with it's recently added implicits functions makes the approach even more appealing. All examples are direct translations of their Haskell version presented in the Typed Tagless Final Interpreters: Lecture Notes (section 2).

The interpreter pattern has recently received a lot of attention in the Scala community. A lot of efforts have been invested in trying to address the biggest shortcomings of ADT/GADT based solutions: extensibility. One can first look at cats' Inject typeclass for an implementation of [Data Type à la Carte](http://www.cs.ru.nl/~W.Swierstra/Publications

@m4dc4p
m4dc4p / gist:a90aa925a500ee8d0feb
Last active Sep 26, 2015
An example of using the HiringThing API using ColdFusion
View gist:a90aa925a500ee8d0feb
<!--- Set the Variable Name for the Jobs --->
<cfset jsonDoc = '' />
<!--- Call the Endpoint --->
<cfhttp method="get" url="http://{YourHost}/remote/jobs/active" username="{UserName}" password="{Password}" result="get" >
</cfhttp>
<!--- Set the Variable for the data retunred and deserialize it --->
<cfset jsonDoc = DeserializeJSON(get.filecontent) />
@m4dc4p
m4dc4p / gist:750435b04d055717717b
Last active Sep 26, 2015
An example of using the HiringThing API using C# and .NET
View gist:750435b04d055717717b
using System.Net;
using System.Web.Script.Serialization;
using System.Text;
//Method to return active jobs
protected Job[] GetJobsFromTheApplicantTracker()
{
const string API_Key = "Insert API Key Here";
const string API_Password = "Insert API Password Here";
@m4dc4p
m4dc4p / haskellButton.js
Created Nov 11, 2011 — forked from joshuasiler/robotButton.js
Javascript function that adds a little surprise to your HTML elements.
View haskellButton.js
/* USAGE EXAMPLE
<style>
.example { padding:15px; border: 2px solid #888; width:100px;float:left;margin-left: 5px; font-size: 50px; margin-top: 50px; }
</style>
<div id="example1" class="example">1</div>
<div id="example2" class="example">2</div>
<div id="example3" class="example">3</div>
<div id="example4" class="example">4</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="/javascript/robotButton.js"></script>