Skip to content

Arrays of type Array Unit are always empty #23

Description

@sarahnya

Since unit is being represented as nil in the generated lua, all arrays of type Array Unit are treated as empty.

minimal example:

module Main where

import Prelude
import Effect (Effect)
import Effect.Console (logShow)
import Data.Array (length)

main :: Effect Unit
main = logShow $ length [unit, unit, unit]

generates

local M = {}
M.Data_Unit_foreign = { unit = nil }
return (function(s) return function() print(s) end end)((function(n) return tostring(n) end)((function(xs) return #xs end)({
  [1] = M.Data_Unit_foreign.unit,
  [2] = M.Data_Unit_foreign.unit,
  [3] = M.Data_Unit_foreign.unit
})))()

and outputs 0 when run.

Any expression that uses the array implementation of guard will be affected by this.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions