active-group / active-group/active-clojure

Sum types with aliases

Đang mở
#33 5 bình luận 0 reaction 1 người được giao Được @smoes nhận Xem trên GitHub
enhancement
Ngôn ngữ chính
Clojure
Star
31
Fork
4
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Defining sum types does not work when aliasing types or predicates in match expressions, in ClojureScript at least:

```
(require '[active.clojure.sum-type :as st :include-macros true])
(require '[active.clojure.cljs.record :as rec :include-macros true])

(rec/define-record-type T {:rtd-record? true} (make-t) t? [])
(st/define-sum-type S1 s? [T])
(def S2 S1)
(st/define-sum-type S2 s? [T])
(def T2 T)
(st/define-sum-type S2 s? [T2])

Compile Exception: rtd-record or sum-type required, found: T2
```

A similar error is raised when using an alias of `t?` in a match expression.

This is quite a burden for code reuse/abstraction, and should be fixed if possible.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.