Skip to content

Commit

Permalink
Fix args instance of Ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
jhbertra committed Nov 2, 2021
1 parent ecce120 commit f6ba33c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ let additions =
, "web-uievents"
]
, repo = "https://github.com/input-output-hk/purescript-web-common"
, version = "v1.1.2"
, version = "v1.1.3"
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/PlutusTx/Ratio.purs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import Data.Argonaut.Encode.Aeson as E
import Data.Profunctor.Strong ((&&&))
import Data.Ratio as R
import Data.Tuple (uncurry)
import Text.Pretty (class Args, class Pretty, hsep, pretty, text)
import Text.Pretty (class Args, class Pretty, hasArgs, hsep, pretty, text)

newtype Ratio a
= Ratio (R.Ratio a)

instance showRatio :: (Show a) => Show (Ratio a) where
show (Ratio x) = show x

instance argsRatio :: Args (Ratio a) where
hasArgs _ = false
hasNestedArgs _ = false
instance argsRatio :: (Args a) => Args (Ratio a) where
hasArgs _ = true
hasNestedArgs (Ratio r) = hasArgs (R.numerator r) || hasArgs (R.denominator r)

instance prettyRatio :: Pretty a => Pretty (Ratio a) where
pretty r = hsep [ pretty $ numerator r, text "%", pretty $ denominator r ]
Expand Down

0 comments on commit f6ba33c

Please sign in to comment.