Why can't I use record selectors with an existentially quantified type?

前端 未结 2 906
谎友^
谎友^ 2021-02-02 08:26

When using Existential types, we have to use a pattern-matching syntax for extracting the foralled value. We can\'t use the ordinary record selectors as functions.

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-02 09:12

    You can use record syntax in pattern matching,

    func1 BigData{ someField = elemx } = func2 elemx
    

    works and is much less typing for huge types.

提交回复
热议问题