Code Monkey home page Code Monkey logo

dsls-in-action-fsharp's Introduction

DSLs in Action in F#

Translation of Code and Examples from Debasish Ghosh's "DSLs in Action"


Purpose

This is an unfaithful translation of the book's examples to F#. Indeed translating examples from 5 different languages to another language is impossible. Therefore, we tried to create roughly similar examples in F# and used original code as the source of ideas and inspiration. Certain examples which cannot be expressed in F# have been omitted or modified to be F#-friendly.


Setup / Installation

The code base contains two solutions: FSharpx.Books.DSLsInAction.sln and FSharpx.Books.DSLsInAction.Mono.sln for Visual Studio 2012 and MonoDevelop 3.0 respectively. These solutions target F# 3.0 since there are a few F# 3.0's features we use in the codebase.

NuGet is used to manage external packages. If you do not have NuGet, or are running a version prior to 2.0, you must install or upgrade it before you will be able to build the projects. In Visual Studio, the easiest way to install NuGet is by downloading it (for free) from the Visual Studio Extension Gallery. On Mono, you can use the bootstrapped version of NuGet.exe in .nuget folder or NuGet add-in for MonoDevelop to install and update packages manually.

The VS2012 solution uses the Package Restore feature of NuGet to automatically download any missing packages when the projects are built. This requires that you have the "Allow NuGet to download missing packages during build" setting enabled; in Visual Studio, you can find the setting under Options -> Package Manager -> General.

Package Restore feature hasn't worked in MonoDevelop (yet). In the project root directory (dsls-in-action-fsharp), you can issue the command sh .nuget/nuget.sh in order that NuGet downloads necessary packages.

Once NuGet is installed and configured, you should be able to build the solution.


Porting notes

The translated examples conform to the following conventions:

  • Each example is named XX.YY.fs where XX is the name of the problem and YY is the language for which the original program is written, including Java, Ruby, Groovy, Clojure and Scala.
  • There are a few examples with Fsharp suffix. They are written from scratch and more F#-ish in implementing DSLs.
  • XX.YY.fsx files are often the corresponding scripting versions of XX.YY.fs files.
  • Many files have // Listing X.Y ... bits which are to reference the book's corresponding snippets.

For detailed notes about F#-specific features for DSL development, please refer to A cheatsheet for F#'s DSL-friendly features.

dsls-in-action-fsharp's People

Contributors

dungpa avatar mausch avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.