IntersectMBO / IntersectMBO/plutus

Investigate if lambdas not annotated with types fail to compile in Plutus Tx

Open
#6,085 2 comments 0 reactions 0 assignees View on GitHub
Good first issue Internal Plinth status: triaged User experience
Dominant language
Haskell
Stars
1.6k
Forks
508
Avg merge
3d 10h
Merged PRs (30d)
22

Description

James Browning reported this issue.

In an earlier plutus version I was able to compile `(\_ _ -> ())` or `(\_ _ _ -> ())` but this now produces an error

```
GHC Core to PLC plugin: Error: Unsupported feature: Kind: forall k. k
Context: Compiling kind: forall k. k
Context: Compiling type: GHC.Types.Any
Context: Compiling expr: \ _ [Occ=Dead] _ [Occ=Dead] -> GHC.Tuple.()
```

Using a `BuiltinData -> BuiltinData -> ()` function still works. Just wondered why this might be and if we care enough

For example, I used to use

```haskell
alwaysSucceedPolicy :: MintingPolicy
alwaysSucceedPolicy = mkMintingPolicyScript $$(PlutusTx.compile [|| (\_ _ -> ()) ||])
```

but now I must do like

```haskell
mkAlwaysSucceedPolicy :: BuiltinData -> BuiltinData -> ()
mkAlwaysSucceedPolicy _datum _sc = ()
```

```haskell
alwaysSucceedPolicy :: SerialisedScript
alwaysSucceedPolicy = serialiseCompiledCode $$(PlutusTx.compile [|| mkAlwaysSucceedPolicy ||])
```

I think it wouldn’t be surprising if we couldn’t compile a naked `\_ _ -> ()` however `mkMintingPolicyScript` does constrain the type of each argument bound by a lambda to `BuiltinData`, so in theory all types are there and GHC should be able to see them. In practice it may of course all be much more complicated than that.

Would be great to make it work, but perhaps not a huge deal if we can’t.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.