├── .gitignore ├── .stylish-haskell.yaml ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── Setup.hs ├── default.nix ├── docs ├── all.js └── index.html ├── exe └── Main.hs ├── hinc.cabal ├── src └── Hinc │ └── Parser.hs ├── stack.yaml ├── syntax.txt ├── web └── Main.hs └── why.md /.gitignore: -------------------------------------------------------------------------------- 1 | .stack* 2 | stack.yaml.lock 3 | result -------------------------------------------------------------------------------- /.stylish-haskell.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - simple_align: 3 | cases: true 4 | top_level_patterns: true 5 | records: true 6 | 7 | # Import cleanup 8 | - imports: 9 | align: global 10 | list_align: after_alias 11 | pad_module_names: true 12 | long_list_align: inline 13 | empty_list_align: inherit 14 | list_padding: 4 15 | separate_lists: true 16 | space_surround: false 17 | 18 | # Language pragmas 19 | - language_pragmas: 20 | style: vertical 21 | align: true 22 | remove_redundant: true 23 | language_prefix: language 24 | 25 | # Remove trailing whitespace 26 | - trailing_whitespace: {} 27 | 28 | columns: 100 29 | newline: native 30 | cabal: true 31 | language_extensions: 32 | - BangPatterns 33 | - ConstraintKinds 34 | - DataKinds 35 | - DefaultSignatures 36 | - DeriveAnyClass 37 | - DeriveDataTypeable 38 | - DeriveGeneric 39 | - DerivingStrategies 40 | - DerivingVia 41 | - ExplicitNamespaces 42 | - FlexibleContexts 43 | - FlexibleInstances 44 | - FunctionalDependencies 45 | - GADTs 46 | - GeneralizedNewtypeDeriving 47 | - InstanceSigs 48 | - KindSignatures 49 | - LambdaCase 50 | - MultiParamTypeClasses 51 | - MultiWayIf 52 | - NamedFieldPuns 53 | - NoImplicitPrelude 54 | - OverloadedStrings 55 | - QuasiQuotes 56 | - RecordWildCards 57 | - ScopedTypeVariables 58 | - StandaloneDeriving 59 | - TemplateHaskell 60 | - TupleSections 61 | - TypeApplications 62 | - TypeFamilies 63 | - ViewPatterns 64 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "[haskell]": { 3 | "editor.formatOnSave": true, 4 | "editor.defaultFormatter": "vigoo.stylish-haskell" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020, Alejandro Serrano 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials provided 14 | with the distribution. 15 | 16 | * Neither the name of Alejandro Serrano nor the names of other 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # `hinc`: Haskell In New Clothes 2 | 3 | Braces-and-parens syntax for your favorite language! 4 | 5 | ### [Try it!](https://serras.github.io/hinc/) 6 | 7 | Check the fully-undocumented `hinc`-to-Haskell transpiler. 8 | 9 | ### [Why?](https://github.com/serras/hinc/blob/master/why.md) 10 | 11 | Discussions as [issues](https://github.com/serras/hinc/issues) are also welcome. 12 | 13 | ### How have you developed it? 14 | 15 | That part is actually quite cool. The whole transpiler is developed using a usual stack of `megaparsec` to parse `hinc` code and `haskell-src-exts` to pretty print Haskell code. All of this, in addition to the front-end developed with Miso, is compiled to a single JavaScript file. Really, completely serverless! -------------------------------------------------------------------------------- /Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | with (import (builtins.fetchTarball { 2 | url = "https://github.com/dmjio/miso/archive/ea25964565074e73d4052b56b60b6e101fa08bc5.tar.gz"; 3 | sha256 = "1yb9yvc0ln4yn1jk2k5kwwa1s32310abawz40yd8cqqkm1z7w6wg"; 4 | }) {}); 5 | let 6 | haskell-src-exts-src = pkgs.fetchFromGitHub { 7 | owner = "haskell-suite"; 8 | repo = "haskell-src-exts"; 9 | rev = "62e545855dd07839c06c750dc68e9b546260c25d"; 10 | sha256 = "0sqa6ylmmycllanvpbm3iq8pr0ccjx274mxlyz9symknri5q4f2x"; 11 | }; 12 | haskell-src-exts = pkgs.haskell.packages.ghcjs.callCabal2nix "haskell-src-exts" haskell-src-exts-src {}; 13 | in 14 | pkgs.haskell.packages.ghcjs.callCabal2nix "hinc" ./. { inherit haskell-src-exts; } -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |