Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haskell guest bindings generator #979

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
init
primoly committed Jun 19, 2024
commit 6237773b5855fef65c972421403f957f582e4195
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@ wit-bindgen-teavm-java = { path = 'crates/teavm-java', version = '0.26.0' }
wit-bindgen-go = { path = 'crates/go', version = '0.26.0' }
wit-bindgen-csharp = { path = 'crates/csharp', version = '0.26.0' }
wit-bindgen-markdown = { path = 'crates/markdown', version = '0.26.0' }
wit-bindgen-haskell = { path = 'crates/haskell', version = '0.26.0' }
wit-bindgen = { path = 'crates/guest-rust', version = '0.26.0', default-features = false }

[[bin]]
@@ -58,6 +59,7 @@ wit-bindgen-markdown = { workspace = true, features = ['clap'], optional = true
wit-bindgen-teavm-java = { workspace = true, features = ['clap'], optional = true }
wit-bindgen-go = { workspace = true, features = ['clap'], optional = true }
wit-bindgen-csharp = { workspace = true, features = ['clap'], optional = true }
wit-bindgen-haskell = { workspace = true, features = ['clap'], optional = true}
wit-component = { workspace = true }
wasm-encoder = { workspace = true }

@@ -69,6 +71,7 @@ default = [
'teavm-java',
'go',
'csharp-naot',
'haskell',
]
c = ['dep:wit-bindgen-c']
rust = ['dep:wit-bindgen-rust']
@@ -78,6 +81,7 @@ go = ['dep:wit-bindgen-go']
csharp = ['dep:wit-bindgen-csharp']
csharp-naot = ['csharp']
csharp-mono = ['csharp']
haskell = ['dep:wit-bindgen-haskell']

[dev-dependencies]
heck = { workspace = true }
23 changes: 23 additions & 0 deletions crates/haskell/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "wit-bindgen-haskell"
version.workspace = true
edition.workspace = true
repository = 'https://github.com/bytecodealliance/wit-bindgen'
license = "Apache-2.0 WITH LLVM-exception"
homepage = 'https://github.com/bytecodealliance/wit-bindgen'
description = """
Haskell bindings generator for WIT and the component model, typically used
through the `wit-bindgen-cli` crate.
"""

[lib]
test = false
doctest = false

[dependencies]
wit-bindgen-core = { workspace = true }
wit-parser = { workspace = true }
anyhow = { workspace = true }
heck = { workspace = true }
clap = { workspace = true, optional = true }
indexmap = { workspace = true }
1,388 changes: 1,388 additions & 0 deletions crates/haskell/src/lib.rs

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/bin/wit-bindgen.rs
Original file line number Diff line number Diff line change
@@ -64,6 +64,15 @@ enum Opt {
#[clap(flatten)]
args: Common,
},

/// Generates bindings for Haskell guest modules.
#[cfg(feature = "haskell")]
Haskell {
#[clap(flatten)]
opts: wit_bindgen_haskell::Opts,
#[clap(flatten)]
args: Common,
},
}

#[derive(Debug, Parser)]
@@ -121,6 +130,8 @@ fn main() -> Result<()> {
Opt::TinyGo { opts, args } => (opts.build(), args),
#[cfg(feature = "csharp")]
Opt::CSharp { opts, args } => (opts.build(), args),
#[cfg(feature = "haskell")]
Opt::Haskell { opts, args } => (opts.build(), args),
};

gen_world(generator, &opt, &mut files)?;