Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Commit

Permalink
stackage fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyday567 committed Dec 30, 2017
1 parent 9d82d42 commit 19c5c02
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions chart-unit.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- see: https://github.com/sol/hpack

name: chart-unit
version: 0.5.4
version: 0.5.5.0
synopsis: Native haskell charts.
description: .
<<https://tonyday567.github.io/other/mainExample.svg>>
Expand Down Expand Up @@ -112,7 +112,8 @@ library
linear,
numhask >=0.0.5 && <1,
numhask-range >=0.0.3 && <1,
palette
palette,
scientific
default-language: Haskell2010
default-extensions: DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances InstanceSigs MultiParamTypeClasses NegativeLiterals NoImplicitPrelude OverloadedStrings PatternSynonyms RankNTypes TypeFamilies UnicodeSyntax

Expand Down
3 changes: 2 additions & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: chart-unit
version: '0.5.4'
version: '0.5.5.0'
synopsis: Native haskell charts.
description: ! '
Expand Down Expand Up @@ -81,6 +81,7 @@ library:
- numhask >=0.0.5 && <1
- numhask-range >=0.0.3 && <1
- palette
- scientific
executables:
chart-source-examples:
main: sourceExamples.hs
Expand Down
6 changes: 4 additions & 2 deletions src/Chart/Hud.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import Chart.Text
import qualified Control.Foldl as L
import Data.List (nub)
import Data.Ord (max)
import Data.Scientific
import Diagrams.Prelude
hiding (Color, D, (*.), (<>), project, width, zero, (<>))
import qualified Diagrams.TwoD.Size as D
Expand Down Expand Up @@ -308,12 +309,13 @@ data TickStyle
-- | Provide formatted text for a list of numbers so that they are just distinguished. 'precision 2 ticks' means give the tick labels as much precision as is needed for them to be distinguished, but with at least 2 significant figues.
precision :: Int -> [Double] -> [Text]
precision n0 xs
| foldr max 0 xs < 0.01 = precLoop Formatting.expt n0 xs
| foldr max 0 xs > 100000 = precLoop Formatting.expt n0 xs
| foldr max 0 xs < 0.01 = precLoop expt n0 (fromFloatDigits <$> xs)
| foldr max 0 xs > 100000 = precLoop expt n0 (fromFloatDigits <$> xs)
| foldr max 0 xs > 1000 =
precLoopInt (const Formatting.commas) n0 (floor <$> xs)
| otherwise = precLoop fixed n0 xs
where
expt x = scifmt Exponent (Just x)
precLoop f n xs' =
let s = sformat (f n) <$> xs'
in if s == nub s
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: nightly-2017-11-22
resolver: nightly-2017-12-29

packages:
- .
Expand Down

0 comments on commit 19c5c02

Please sign in to comment.