Skip to content

Union constraint to add label to row doesn't work #3242

@chexxor

Description

@chexxor

I was playing with different ways of composing type-synonymed rows together and I hit a compilation error that I can't understand.

Is this a bug in the type-checker? Perhaps the record field accessor (the .page code here) doesn't have access to the Union constraint?

module Main where

import Prelude

type PaginationRow = ( page :: Int )

f :: forall r. Union PaginationRow () r => Record r -> String
f r = "Page = " <> show r.page
-- Could not match type  r1  with type  ( page :: to | t1 )

g :: forall r. Union ( page :: Int ) () r => Record r -> Int
g r = r.page
-- Could not match type  r1  with type  ( page :: Int | t0 )
-- (Fixed the error messages - they were both `page :: String` before)

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