summaryrefslogtreecommitdiff
path: root/src/runtime/haskell-bind/README
blob: 60251e653d21ba87df4804fb440e6a945d0c459b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# PGF2

This is a Haskell binding to the PGF runtime in C.

The files are:

- PGF2.hsc: a user API similar to Python and Java APIs
- PGF2/FFI.hs: an internal module with FFI definitions for the relevant C functions

## How to compile

```
cabal install
```

**Note:** you must have the PGF C runtime already installed and available.
See <https://github.com/GrammaticalFramework/gf-core/blob/master/src/runtime/c/INSTALL>

## How to use

Import PGF to the Haskell program that you're writing. 
The Cabal infrastructure will make sure to tell the compiler
where to find the relevant modules.

## Example

```haskell
module Main where

import PGF2
import qualified Data.Map as Map

main = do
  pgf <- readPGF "Foo.pgf"
  let Just english = Map.lookup "FooEng" (languages pgf)
```

## Changelog

### 1.1.0

Remove SG library.

### 1.0.0

Everything up until 2020-07-11.