-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf6f934
commit 0a6c286
Showing
1 changed file
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,18 +185,18 @@ styleToOutput globalToOutput normToOutput = | |
toOutput :: forall v. (Data v, Data (Scalar v), Num (Scalar v), Ord (Scalar v), Fractional (Scalar v)) | ||
=> Scalar v -> Scalar v -> Measure v -> Measure v | ||
toOutput g n m = | ||
case (g, n, m) of | ||
(_, _, m'@(Output _)) -> m' | ||
(_, _, (Local s)) -> Output s | ||
(g', _, (Global s)) -> Output (g' * s) | ||
(_, n', (Normalized s)) -> Output (n' * s * 0.01) | ||
|
||
(g', n', (MinM m1 m2)) -> outBin min (toOutput g' n' m1) (toOutput g' n' m2) | ||
(g', n', (MaxM m1 m2)) -> outBin max (toOutput g' n' m1) (toOutput g' n' m2) | ||
(_ , _ , (ZeroM)) -> Output 0 | ||
(g', n', (NegateM m')) -> outUn negate (toOutput g' n' m') | ||
(g', n', (PlusM m1 m2)) -> outBin (+) (toOutput g' n' m1) (toOutput g' n' m2) | ||
(g', n', (ScaleM s m')) -> outUn (s*) (toOutput g' n' m') | ||
case m of | ||
m'@(Output _) -> m' | ||
Local s -> Output s | ||
Global s -> Output (g * s) | ||
Normalized s -> Output (n * s * 0.01) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jeffreyrosenbluth
Author
Member
|
||
|
||
MinM m1 m2 -> outBin min (toOutput g n m1) (toOutput g n m2) | ||
MaxM m1 m2 -> outBin max (toOutput g n m1) (toOutput g n m2) | ||
ZeroM -> Output 0 | ||
NegateM m' -> outUn negate (toOutput g n m') | ||
PlusM m1 m2 -> outBin (+) (toOutput g n m1) (toOutput g n m2) | ||
ScaleM s m' -> outUn (s*) (toOutput g n m') | ||
where | ||
outUn op (Output o1) = Output (op o1) | ||
outUn _ _ = error "outUn: The sky is falling!" | ||
|
Also, I'm going to argue that we make
Normalized
relative to 1 again instead of 100. I think we are moving in a direction where idiomatic diagrams code doesn't have many (if any) explicit literal numeric values written down for measures. The cases I can think of where you would want to explicitly supply a number are of the sort where you have computed some number (rather than writing a numeric literal in your program), in which case it makes much more sense to have it be relative to 1 instead of 100.