Home

Awesome

Hafas Client in F#

Ths is a port of the JavaScript hafas-client library to F#, a client for HAFAS public transport APIs.

The hafas endpoints Db, Bvg and Svv are supported.

The F# library compiles to dotnet and (via Fable) to JavaScript and Python.

Interfaces

The library exposes 3 interfaces:

  1. a direct (raw) interface to the hafas endpoints,
  2. a F# async based interface corresponding to hafas-client api,
  3. a JS promise based interface corresponding to the TS Type definitions for hafas-client.

Compilation to JavaScript

The JS promise based interface compiles via Fable to a JavaScript library, this library and the original hafas-client can be used almost interchangeably.

The following diagram should commute:

JavaScript/TypeScriptTransformationF#
hafas-client TS types=> ts2fable and Transformer =>hafas-client F# types
⇓ implementation
hafas-client TS types, JS Program<= fable <=hafas-client F# types, F# program

Compilation to Python

Compilation to Python with dotnet fable --lang Python uses fable 4. All currently missing features have a comment workaround.

Documentation

Building

Requirements

Run ./build.sh or ./build.cmd at the root folder.

Targets

Utility scripts

Packages

There are several packages generated in the build process.

NuGet packages

The nuget packages are generated from the fshafas projects and can be used with the dotnet tool.

npm package

The fs-hafas-client-x.y.z.tgz npm package is generated from the fshafas.javascript.package project and can be used in a JavaScript program.

Python package

The fshafas-x.y.z-py3-none-any.whl Python package is generated from the fshafas.python.package project and can be used in a Python program.

Using