Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Custom errors aren't reported at the right location

Closed
#599 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Domain
compilers

Research direction

Install the stated debug and yoga-json packages, then reproduce the diagnostics with the provided Main.purs example. Trace how the compiler assigns locations to the custom errors and warnings shown in the output; done means those diagnostics point to their actual originating spans rather than the reported locations.

Written by the indexing model from the issue text.

Description

module Main where

import Prelude

import Effect (Effect)
import Data.Variant (Variant)
import Data.Variant as Variant
import Type.Proxy (Proxy(..))
import Yoga.JSON as JSON
import Debug (traceM)
import Yoga.JSON.Variant (TaggedVariant(..))

type V = (a :: {}, b :: {})
type TV = TaggedVariant "type" "value" V
type Var = Variant V

main :: Effect Unit
main = do
  tv
  tv2

tv = do
  let f = JSON.write ((fromHomogeneous { a: {} }) :: Var)
  traceM f
  traceM $ JSON.read @Var f

tv2 = do
  let f = JSON.write (TaggedVariant $ (Variant.inj (Proxy @"a") {}) :: TV)
  traceM f
  traceM $ JSON.read @TV f

Error! · [NotInScope] · src/Main.purs:23:24
  •
  │
  • 'fromHomogeneous' is not in scope
  │
  │     let f = JSON.write ((fromHomogeneous { a: {} }) :: Var)
  │                          ╰──────────────
  •

Warning! · [CustomWarning] · src/Main.purs:27:1
  •
  │
  • Debug function usage
  │
  │   tv2 = do
  │   ╰───────
  •

Warning! · [CustomWarning] · src/Main.purs:27:1
  •
  │
  • Debug function usage
  │
  │   tv2 = do
  │   ╰───────
  •

Error! · [CannotUnify] · src/Main.purs:23:24
  •
  │
  • Cannot unify '?[invalid function application]' with 'Variant V'
  │
  │     let f = JSON.write ((fromHomogeneous { a: {} }) :: Var)
  │                          ╰────────────────────────
  •

Warning! · [CustomWarning] · src/Main.purs:22:1
  •
  │
  • Debug function usage
  │
  │   tv = do
  │   ╰──────
  •

Warning! · [CustomWarning] · src/Main.purs:22:1
  •
  │
  • Debug function usage
  │
  │   tv = do
  │   ╰──────
  •

You'll need spago install debug and spago install yoga-json

Dominant language
Rust
Stars
117
Forks
11
Avg merge
4h 22m
Merged PRs (30d)
126

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from purefunctor/purescript-iris

All issues in purefunctor/purescript-iris

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.