-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
140 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.stack-work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
cabal-version: 1.12 | ||
|
||
-- This file has been generated from package.yaml by hpack version 0.35.1. | ||
-- | ||
-- see: https://github.com/sol/hpack | ||
|
||
name: brossa | ||
version: 0 | ||
author: Chris Done | ||
maintainer: Chris Done | ||
copyright: 2023 Chris Done | ||
license: BSD3 | ||
build-type: Simple | ||
|
||
executable hell | ||
main-is: Hell.hs | ||
other-modules: | ||
Paths_brossa | ||
ghc-options: -threaded -rtsopts -with-rtsopts=-N | ||
build-depends: | ||
async | ||
, base | ||
, bytestring | ||
, constraints | ||
, containers | ||
, directory | ||
, ghc-prim | ||
, haskell-src-exts | ||
, hspec | ||
, mtl | ||
, syb | ||
, temporary | ||
, text | ||
default-language: Haskell2010 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
main = Text.putStrLn "Hello, World!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
main = do | ||
Text.putStrLn "Please enter your name and hit ENTER:" | ||
name :: Text <- Text.getLine | ||
Text.putStrLn "Thanks, your name is: " | ||
Text.putStrLn name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: brossa | ||
version: 0 | ||
license: BSD3 | ||
author: "Chris Done" | ||
copyright: "2023 Chris Done" | ||
|
||
dependencies: | ||
- base | ||
- haskell-src-exts | ||
- hspec | ||
- ghc-prim | ||
- containers | ||
- text | ||
- bytestring | ||
- async | ||
- mtl | ||
- directory | ||
- temporary | ||
- syb | ||
- constraints | ||
|
||
executables: | ||
hell: | ||
main: Hell.hs | ||
ghc-options: | ||
- -threaded | ||
- -rtsopts | ||
- -with-rtsopts=-N |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,59 @@ | ||
Working example: | ||
# hell | ||
|
||
```haskell | ||
foo = Main.bar | ||
Hell is a statically-typed shell scripting language and | ||
implementation, which re-uses Haskell's standard library and runtime. | ||
|
||
main = Main.foo | ||
## Running | ||
|
||
bar = do | ||
x :: () <- Text.putStrLn "Hello, please enter your name" | ||
line :: Text <- Text.getLine | ||
Text.putStrLn "Hello, " | ||
let msg :: Text = ((\(x :: Text) (y :: Int) -> x) line 5) | ||
Text.putStrLn msg | ||
``` | ||
Presently the `hell` binary type-checks and interprets immediately a | ||
program in `IO`. | ||
|
||
$ hell examples/01-hello-world.hell | ||
Hello, World! | ||
|
||
## Informal description | ||
|
||
See `examples/` for a list of example scripts. | ||
|
||
Example program: | ||
|
||
```haskell | ||
main = do | ||
Text.putStrLn "Please enter your name and hit ENTER:" | ||
name :: Text <- Text.getLine | ||
Text.putStrLn "Thanks, your name is: " | ||
Text.putStrLn name | ||
``` | ||
$ ./hell foo.hell | ||
Hello, please enter your name | ||
Dabe | ||
Hello, | ||
Dabe | ||
|
||
## More formal description | ||
|
||
The language is a DSL, it's the simply-typed lambda calculus, plus | ||
some syntactic sugar and some primitives that can be polymorphic (but | ||
require immediately applied type applications). Recursion is not | ||
supported. | ||
|
||
Polymorphic primitives such as `id` require passing the type of the | ||
argument as `id @Int 123`. You cannot define polymorphic lambdas of | ||
your own. It's not full System-F. | ||
|
||
It will support type-classes (for equality, dictionaries, etc), but | ||
the dictionaries must be explicitly supplied. You can't define | ||
classes, or data types, of your own. | ||
|
||
The types and functions available lean directly on the host language | ||
(Haskell) and are either directly lifted, or a simplified layer over | ||
the original things. | ||
|
||
There is (presently) no type inference. All parameters of lambdas, or | ||
do-notation let bindings, must have their type declared via a pattern | ||
signature. | ||
|
||
```haskell | ||
\(x :: Int) -> x | ||
``` | ||
|
||
## Building | ||
|
||
Build statically for Linux in a musl distribution: | ||
|
||
stack build --ghc-options="-static -optl-static" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
resolver: lts-20.24 | ||
system-ghc: true | ||
packages: | ||
- '.' | ||
allow-different-user: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file was autogenerated by Stack. | ||
# You should not edit this file by hand. | ||
# For more information, please see the documentation at: | ||
# https://docs.haskellstack.org/en/stable/lock_files | ||
|
||
packages: [] | ||
snapshots: | ||
- completed: | ||
sha256: e019cd29e3f7f9dbad500225829a3f7a50f73c674614f2f452e21bb8bf5d99ea | ||
size: 650253 | ||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/24.yaml | ||
original: lts-20.24 |