# No way to do ImplicitParams + Function definition syntax

**URL:** <https://discourse.haskell.org/t/no-way-to-do-implicitparams-function-definition-syntax/13537>\
**Category:** Learn\
**Created:** [January 15, 2026, 2:58am UTC](https://discourse.haskell.org/t/no-way-to-do-implicitparams-function-definition-syntax/13537 "2026-01-15T02:58:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashokkimmel](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/ashokkimmel/32/5111_2.png) [@ashokkimmel](https://discourse.haskell.org/u/ashokkimmel)\
**Post date:** [January 15, 2026, 2:58am UTC](https://discourse.haskell.org/t/no-way-to-do-implicitparams-function-definition-syntax/13537/1 "2026-01-15T02:58:36Z")

</div>

Let’s say I have the following

```haskell
doStuff :: (?assert :: Bool -> String -> IO ()) => IO () 

```

and I want to say, while I’m debugging a problem, that

```haskell
main :: IO ()
main = doStuff where 
    ?assert x y = if x then pure () else putStrLn $ "Assertion failed <" ++ y ++ ">"

```

Will give a parse error. I get that this isn’t strictly necessary, but I’m wondering if there is a reason it wasn’t implemented and how hard it would be to fix (I. e. update GHC to make it work).

---

<div class="post-metadata">

**Author:** ![therivercass](https://avatars.discourse-cdn.com/v4/letter/t/d6d6ee/32.png) [@therivercass](https://discourse.haskell.org/u/therivercass)\
**Post date:** [January 15, 2026, 12:37pm UTC](https://discourse.haskell.org/t/no-way-to-do-implicitparams-function-definition-syntax/13537/2 "2026-01-15T12:37:55Z")

</div>

this reads like `?assert` is being provided to `doStuff` via dynamic scoping? or am I not following the syntax?

implicitly read values from context are usually handled in Haskell via typeclasses.

---

<div class="post-metadata">

**Author:** ![tomjaguarpaw](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/tomjaguarpaw/32/1230_2.png) [@tomjaguarpaw](https://discourse.haskell.org/u/tomjaguarpaw)\
**Post date:** [January 15, 2026, 12:40pm UTC](https://discourse.haskell.org/t/no-way-to-do-implicitparams-function-definition-syntax/13537/3 "2026-01-15T12:40:57Z")

</div>

> [@therivercass](#):
>
> this reads like `?assert` is being provided to `doStuff` via dynamic scoping?

Correct. This is called an “implicit parameter”.

> **[6.11.6. Implicit parameters — Glasgow Haskell Compiler 9.15.20260114 User's...](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/implicit_parameters.html)**

---

<div class="post-metadata">

**Author:** ![ashokkimmel](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/ashokkimmel/32/5111_2.png) [@ashokkimmel](https://discourse.haskell.org/u/ashokkimmel)\
**Post date:** [January 15, 2026, 12:53pm UTC](https://discourse.haskell.org/t/no-way-to-do-implicitparams-function-definition-syntax/13537/4 "2026-01-15T12:53:57Z")

</div>

The user’s guide actually mentions

An implicit-parameter binding group must be a collection of simple bindings to implicit-style variables (no function-style bindings, and no type signatures); these bindings are neither polymorphic or recursive.

I am just curious as to why. I couldn’t find the actual proposal.

---

<div class="post-metadata">

**Author:** ![hsyl20](https://avatars.discourse-cdn.com/v4/letter/h/b4bc9f/32.png) [@hsyl20](https://discourse.haskell.org/u/hsyl20)\
**Post date:** [January 16, 2026, 8:47pm UTC](https://discourse.haskell.org/t/no-way-to-do-implicitparams-function-definition-syntax/13537/5 "2026-01-16T20:47:20Z")

</div>

You should open a GHC ticket about this. I couldn’t find one

---

<div class="post-metadata">

**Author:** ![ashokkimmel](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/ashokkimmel/32/5111_2.png) [@ashokkimmel](https://discourse.haskell.org/u/ashokkimmel)\
**Post date:** [January 17, 2026, 12:22am UTC](https://discourse.haskell.org/t/no-way-to-do-implicitparams-function-definition-syntax/13537/6 "2026-01-17T00:22:38Z")

</div>

It’s expected behavior, I’m just wondering why.

---

<div class="post-metadata">

**Author:** ![kabuhr](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kabuhr](https://discourse.haskell.org/u/kabuhr)\
**Post date:** [January 18, 2026, 5:40pm UTC](https://discourse.haskell.org/t/no-way-to-do-implicitparams-function-definition-syntax/13537/7 "2026-01-18T17:40:29Z")

</div>

There’s an open [issue #12360](https://gitlab.haskell.org/ghc/ghc/-/issues/12360) about allowing implicit parameters in patterns. As far as I can see, the examples discussed there don’t actually cover the case of defining a function-valued implicit parameter, but a general solution would cover this case as well. The general consensus seems to be that there’s no technical reason not to allow this.

---

<div class="post-metadata">

**Author:** ![ashokkimmel](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/ashokkimmel/32/5111_2.png) [@ashokkimmel](https://discourse.haskell.org/u/ashokkimmel)\
**Post date:** [January 19, 2026, 2:57am UTC](https://discourse.haskell.org/t/no-way-to-do-implicitparams-function-definition-syntax/13537/8 "2026-01-19T02:57:47Z")

</div>

I was thinking about trying to fix the issue myself, as I want to contribute to GHC. However, while I think that `HsLocalBindsLR` and `Pat` are the things that need fixing, I’m worried that I’ll have to deal with tons of breakages, and I’m not being inspired by this thread:

> **[Poor contribution experience (#26728) · Issues · Glasgow Haskell Compiler /...](https://gitlab.haskell.org/ghc/ghc/-/issues/26728)**
>
> GHC has an exceptionally poor contribution experience. This ticket is to serve as documentation and discussion space of those issues.

I’m mainly self-taught in terms of Haskell, so I wouldn’t have much access to the wealth of knowledge that people have on GHC. Also, I haven’t even tried yet, the whole idea just seems so intimidating.

---

<div class="post-metadata">

**Author:** ![simonpj](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/simonpj/32/890_2.png) [@simonpj](https://discourse.haskell.org/u/simonpj)\
**Post date:** [January 19, 2026, 8:41am UTC](https://discourse.haskell.org/t/no-way-to-do-implicitparams-function-definition-syntax/13537/9 "2026-01-19T08:41:15Z")

</div>

> [@ashokkimmel](#):
>
> ```haskell
> main :: IO ()
> main = doStuff where 
> ?assert x y = if x then pure () else putStrLn $ "Assertion failed <" ++ y ++ ">"
> 
> ```

You can definitely say

```haskell
main = doStuff where 
    ?assert = \ x y -> if x then pure () else putStrLn $ "Assertion failed <" ++ y ++ ">"

```

Your suggestion is to allow function-definition syntax in implicit-parameter bindings.

That might be possible (to a first approximation it’s just syntactic sugar) but there is always a cost/benefit tradeoff, one that you could explore with the community by writing a [GHC proposal](https://github.com/ghc-proposals/ghc-proposals).

Things to consider: can the binding be recursive? Mutually recursive? Polymorphic? Can you put implicit parameter bindigns in patterns `(?x, ?y) = blah`?
