Skip to content

Compilation error #199

Description

@brekk

What version of Madlib are you running?

0.27.1

How is Madlib installed on your system?

Installed via npm

What were you trying to do?

filterById :: List TripleCode -> List TripleCode
filterById = (codes) => {
  _getNames = (out, _keys) => where(_keys) {
    [] =>
      out

    [x, ...xs] =>
      where(x.entry) {
        Just({ channels, isDefault, name }) =>
          _getNames(Set.insert(name, out), xs)

        _ =>
          _getNames(out, xs)
      }
  }
  names = _getNames(Set.empty, codes)
  _getDefaultOrLast = (out, _keys) => where(_keys) {
    [] =>
      out

    [x, ...xs] =>
      where(x.entry) {
        Just({ channels, isDefault, name }) =>
          if (isDefault) {
            _getDefaultOrLast(Dict.insert(name, isDefault, out), xs)
          } else if (
            pipe(
              Dict.get(name),
              Maybe.fromMaybe(false),
            )(out)
          ) {
            _getDefaultOrLast(Dict.insert(name, false, out), xs)
          } else {
            _getDefaultOrLast(out, xs)
          }

        _ =>
          _getDefaultOrLast(out, xs)
      }
  }
  raw = _getDefaultOrLast(Dict.empty, codes)
  IO.pTrace("RAWS", raw)
  return codes
}

https://github.com/brekk/mad-literate/blob/7582b668912b9116d7e7c45b79e4e87e51cf48d3/src/CodeBoundary.mad#L81-L123 This code fails during LLVM code compilation

What did you expect to happen?

No error, or an error before runtime

What actually happened?

A big headache

mad-literate.log

Logs

See the mad-literate.log above for the full context, but the relevant detail appears to be:

madlib: Function not found getNames
area: Area (Loc 2188 95 11) (Loc 2196 95 19)
ST: fromList
  [ ( "/opt/homebrew/lib/node_modules/@madlib-lang/madlib/node_modules/binary-install/node_modules/.bin/prelude/__internal__/Maybe.mad_Maybe"
    , Symbol
        (ADTSymbol 1 2)
        (ConstantOperand
           Null
             { constantType =
                 PointerType
                   { pointerReferent = IntegerType { typeBits = 8 }
                   , pointerAddrSpace = AddrSpace 0
                   }
             })
    )

Code Targets

LLVM

Environment details

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions