Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Transform.compose to have more specific typing #81

Merged
merged 6 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/joy.mli
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ val complex : shapes -> shape
val rotate : int -> shape -> shape
val translate : float -> float -> shape -> shape
val scale : float -> shape -> shape
val compose : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
val compose : (shape -> shape) -> (shape -> shape) -> shape -> shape
FayCarsons marked this conversation as resolved.
Show resolved Hide resolved
val repeat : int -> (shape -> shape) -> shape -> shape
val context : Context.context option ref
val set_color : float * float * float -> unit
Expand Down
2 changes: 2 additions & 0 deletions lib/transform.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
open Shape

type transform = (shape -> shape)
FayCarsons marked this conversation as resolved.
Show resolved Hide resolved

let rec translate dx dy shape =
match shape with
| Circle circle ->
Expand Down
11 changes: 6 additions & 5 deletions lib/transform.mli
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
val translate : float -> float -> Shape.shape -> Shape.shape
val scale : float -> Shape.shape -> Shape.shape
val rotate : int -> Shape.shape -> Shape.shape
val compose : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
val repeat : int -> (Shape.shape -> Shape.shape) -> Shape.shape -> Shape.shape
type transform = (Shape.shape -> Shape.shape)
val translate : float -> float -> transform
FayCarsons marked this conversation as resolved.
Show resolved Hide resolved
val scale : float -> transform
val rotate : int -> transform
val compose : transform -> transform -> transform
val repeat : int -> transform -> transform
Loading