/DATX02-DIT561

Primary LanguageHaskellOtherNOASSERTION

DATX02-DIT561

Haskell CI

Daison Frontend

This project is the result of a Bachelor's thesis in Computer science and engineering (DATX02 / DIT561), given at Chalmers University of Technology and University of Gothenborg.

The purpose of the project is to study how the compiler GHC can be used as a library to build a front-end for Daison. The project focuses in particular on how GHC as a library can be used to build interactive Haskell environments.

Project structure

Running the application

We used Cabal to automate dependency installations, building as well as testing the project. Run the following commands from the source folder:

Run:

cabal run daison-frontend

Test:

cabal test

Build executable

cabal build exe:daison-frontend

Get a simple binary in the folder dist/

cabal install exe:daison-frontend --install-method=copy --overwrite-policy=always --installdir=dist

Example usage

  1. Start the program

~$ daison-frontend

  1. Open a database

:open database.db

  1. Load a local file with table and type definitions (people :: Table Person, Person :: Person { name :: String, age :: Int})

:load People.hs

  1. Create a table which is defined in People.hs

tryCreateTable people

  1. Read all entries in the people table

select [x | x <- from people everything]

  1. Insert a new person into the table people

insert people $ return $ Person "Alice" 15

  1. Update her age
let pkey = fst it
update people [(pkey, person{age=25}) | person <- from people (at pkey)]
  1. Close the program

:quit

Available commands

Command Description
<statement> evaluate/run <statement>
:dbs print the list of databases that are currently open
:?, :help display this list of commands
:log path display the log file's path
:log show display the log file's contents
:log toggle enable/disable logging
:log wipe attempt to wipe the log file's contents
:type <expr> show the type of <expr>
:q, :quit quit the program
:! <command> run the shell command <command>
:close <name> close database with <name> if opened
:mode [mode] set access mode to [mode] if provided; displays the current access mode otherwise
:open <name> open database with <name> or set focus to <name> if already opened
:cd <dir> set the current directory to <dir> (relative to current location)
:module <module> import <module> if it exists and is in scope
:load <filepath> load a haskell file from <filepath>
:set <option> set GHC <option>

Authors

Name GitHub-handle
Christoffer Kaltenbrunner kaltenbrunner
Alexander Neldefors PUGzera
Hugo Stegrell steget
Philip Vedin pvedin