File: luarepl.hs

package info (click to toggle)
haskell-hslua-repl 0.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 72 kB
  • sloc: haskell: 119; makefile: 6
file content (28 lines) | stat: -rw-r--r-- 776 bytes parent folder | download
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
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications  #-}
{- |
Module      : Main
Copyright   : © 2022-2024 Albert Krewinkel
License     : MIT
Maintainer  : Albert Krewinkel <tarleb@hslua.org>

A simple Lua REPL.
-}
module Main (main) where
import Control.Monad (void)
import HsLua.Core  as Lua (Exception, openlibs, run)
import HsLua.REPL (Config (..), defaultConfig, repl, setup)
import qualified Data.Text as T

-- | Run a default Lua interpreter.
main :: IO ()
main = run @Lua.Exception $ do
  let config = Config
        { replPrompt = "luarepl"
        , replInfo = replInfo defaultConfig `T.append`
                     "\nREPL: © 2023-2024 Albert Krewinkel"
        , replHistory = Just ".luarepl-history"
        }
  openlibs
  setup config
  void repl