Skip to content

Instantly share code, notes, and snippets.

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 September 26, 2015 00:55
An example of using the HiringThing API using ColdFusion
<!--- 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 September 26, 2015 00:54
An example of using the HiringThing API using C# and .NET
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 November 11, 2011 21:34 — forked from joshuasiler/robotButton.js
Javascript function that adds a little surprise to your HTML elements.
/* 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>