Skip to content

Commit f5a080e

Browse files
iitalicslexi-lambda
authored andcommitted
Change order of type<: in pat⇐
Added Laarhoven lenses type as a test. closes #46
1 parent 5f6b550 commit f5a080e

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

hackett-lib/hackett/private/adt.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@
327327
(values (listof (cons/c identifier? type?))
328328
(-> (listof identifier?) (values syntax? (listof identifier?)))))
329329
(let-values ([(t_⇒ assumps mk-pat) (pat⇒! pat)])
330-
(type<:! t_⇒ t #:src (pat-base-stx pat))
330+
(type<:! t t_⇒ #:src (pat-base-stx pat))
331331
(values assumps mk-pat)))
332332

333333
; Combines a list of `match` pattern constructors to properly run them against a list of identifiers
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#lang hackett
2+
(require hackett/data/identity)
3+
4+
(data (Lens s t a b)
5+
(L (∀ [f] (Functor f) => {{a -> (f b)} -> {s -> (f t)}})))
6+
7+
(defn make-lens : (∀ [s t a b] {{s -> a} -> {s -> b -> t} -> (Lens s t a b)})
8+
[[get set]
9+
(L (λ [afb s]
10+
{(set s) <$> (afb (get s))}))])
11+
12+
(defn modify : (∀ [s t a b] {(Lens s t a b) -> {a -> b} -> {s -> t}})
13+
[[(L l) func s]
14+
(run-identity (l {Identity . func} s))])
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#lang hackett
2+
3+
(data Nop
4+
(nop (∀ [a] {a -> a})))
5+
(defn ->nop : (∀ [a] {a -> Nop -> a})
6+
[[x (nop f)] (f x)])

0 commit comments

Comments
 (0)