#GHC s #wasm backend,native uses the native bignum backend and the wasm native #codegen Compared to the #gmp flavour, the run-time performance may be slightly worse if the workload involves big Integer operations. May be useful if you are compiling proprietary projects and have concerns about statically linking the #LGPL-licensed gmp library.
Besides wasm MVP, certain extensions are used. The feature flags are enabled globally in our wasi-sdk build, passed at GHC configure time, and the wasm NCG may make use of the features. The rationale of post-MVP wasm feature inclusion:
Non-browser non-JavaScript runtimes

wasmtime
wasmedge
toywasm
wasmi

Non-browser #JavaScript runtimes

node, using the builtin wasi module to provide WASI implementation
bun, using the builtin WASI implementation
deno, using a legacy WASI implementation in std
#browsers

WASI spec includes certain syscalls that are provided as the wasi_snapshot_preview1 wasm imports. Additionally, the current WASI ABI specifies two different kinds of WASI modules: commands and reactors.
When linking a program for almost any platform out there, the linker needs to handle ctors(constructors) & dtors(destructors). ctors and dtors are special functions that need to be invoked to correctly initialize/finalize certain runtime state. Even if the user program doesn't use ctors/dtors, as long as the program links to libc, ctors/dtors will need to be handled.

Add --export flag for malloc/free. You can now allocate and free linear memory buffers that can be visible to the Haskell world, since the entire linear memory is available as the memory export.
In the #Haskell world,
https://github.com/palas/ghc-wasm-meta

GitHub - palas/ghc-wasm-meta: Fork of `haskell-wasm/ghc-wasm-meta` (from here: https://gitlab.haskell.org/haskell-wasm/ghc-wasm-meta)

Fork of `haskell-wasm/ghc-wasm-meta` (from here: https://gitlab.haskell.org/haskell-wasm/ghc-wasm-meta) - palas/ghc-wasm-meta

GitHub

"Compiler and runtime support for continuation marks" (PLDI 2020) https://dl.acm.org/doi/10.1145/3385412.3385981
"Continuation marks enable dynamic binding and context inspection in a language with proper handling of tail calls and first-class, multi-prompt, delimited continuations."

GHC proposal: "scoped thread-locals" https://github.com/ghc-proposals/ghc-proposals/pull/751
"efficient storage and lookup for immutable context
attached to the current Haskell thread, which is inherited by child threads."

#Haskell #ghc

Compiler and runtime support for continuation marks | Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation

ACM Conferences

Packages like `text` reach into the unstable bowels of #GHC to avoid allocating intermediate structures when reading IO.

But it is possible to do fusible lazy IO:

```
produce :: IO [Char]
produce = IO $ \s0 ->
(# s0 , build $ \c n ->
let go s = case runIO getChar s of
(# s' , x #) -> c x (go s')
in go s0
#)
```

Perhaps GHC could expose something like that and the text package could use it.

#haskell

TIL #GHC already has some functionality in place to check that a function is only used at a monomorphic type. Currently, I think it is only used for `tagToEnum#` but it would be useful to properly integrate it into the type system.

#haskell

#haskell development be mostly busywork for new #ghc versions...

2d61b20 relax dependencies for ghc-9.14
df41b88 relax dependencies for ghc-9.8
f5ce400 relax dependencies for ghc-9.6
4b4417f (tag: v0.1.2.1) v0.1.2.1
28330e6 relax dependencies for ghc-9.4
eac7560 fix incorrect wrapper on Win64
4ea1b67 bump dependencies for ghc 9.2

An new proposal for passing implicit parameters to #Haskell functions: https://github.com/ghc-proposals/ghc-proposals/pull/741

Done the right way; as opposed to the existing ImplicitParams extension, which is practically useless.

#GHC

Nominal implicit parameters by lortabac · Pull Request #741 · ghc-proposals/ghc-proposals

This proposal introduces NominalImplicitParams, a new GHC extension that provides first-class support for dynamic scoping with robust and predictable semantics. Rendered

GitHub
Is "in the first argument of..." etc in type error messages useful?

In case any readers don’t know (it is not well documented): you can disable the “In the first argument of” etc. contextual messages with the GHC option -fno-show-error-context, see Debugging Haskell Type Errors - #4 by MangoIV you can set a limit for the “Relevant bindings include” section with -fmax-relevant-binds=⟨n⟩, see 5.3. Optimisation (code improvement) — Glasgow Haskell Compiler 9.14.1 User's Guide … but -fmax-relevant-binds=0 didn’t work as expected for me

Haskell Community

https://www.reddit.com/r/haskell/comments/plfotc/comment/hcd0le4/

I just learnt two important examples that #GHC fails to optimise code:
one being `Map.fromSet` on polymorphic type, the other being improperly inlining `Set.fromList somelist`.

#Haskell #Compiler

impurepics - #Haskell Extensions
https://impurepics.com/posts/2019-08-01-haskell-extensions.html

A collection of short descriptions and examples of #GHC extensions

#PL #FP

impurepics - Haskell Extensions

impurepics, all kinds of impure pics