hamler icon indicating copy to clipboard operation
hamler copied to clipboard

Cannot create record with '=' in REPL

Open emqplus opened this issue 4 years ago • 1 comments

> data Person = Person {name :: String, age :: Integer}
> p = Person {name = "John", age = 12}
Error found:
in module $PSCI
at :1:5 - 1:37 (line 1, column 5 - line 1, column 37)

  Could not match type

    Record

  with type

    Function
      { age :: Integer
      , name :: List Char
      }


while trying to match type { age :: t1
                           , name :: t0
                           | t2
                           }
  with type { age :: Integer
            , name :: List Char
            }
            -> Person
while checking that expression $0
  has type { age :: t1
           , name :: t0
           | t2
           }
in value declaration p

where t2 is an unknown type
      t0 is an unknown type
      t1 is an unknown type

emqplus avatar Jun 17 '20 06:06 emqplus

Record literals use :, not =

prescientmoon avatar Jun 27 '20 17:06 prescientmoon