Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions plutus-ledger-api/changelog.d/20251127_160032_bezirg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Added

- Brought back Ratio.from/toGHC as deprecated.
2 changes: 2 additions & 0 deletions plutus-ledger-api/src/PlutusLedgerApi/Data/V3.hs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ module PlutusLedgerApi.Data.V3
, Ratio.denominator
, Ratio.fromHaskellRatio
, Ratio.toHaskellRatio
, Ratio.fromGHC
, Ratio.toGHC

-- *** Association maps
, V2.Map
Expand Down
2 changes: 2 additions & 0 deletions plutus-ledger-api/src/PlutusLedgerApi/V3.hs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ module PlutusLedgerApi.V3
, Ratio.denominator
, Ratio.fromHaskellRatio
, Ratio.toHaskellRatio
, Ratio.fromGHC
, Ratio.toGHC

-- *** Association maps
, V2.Map
Expand Down
3 changes: 3 additions & 0 deletions plutus-tx/changelog.d/20251127_160027_bezirg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Added

- Brought back Ratio.from/toGHC as deprecated.
9 changes: 9 additions & 0 deletions plutus-tx/src/PlutusTx/Ratio.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ module PlutusTx.Ratio
-- * Conversion from/to Haskell
, fromHaskellRatio
, toHaskellRatio
, fromGHC
, toGHC
) where

import PlutusTx.Applicative qualified as P
Expand Down Expand Up @@ -399,6 +401,13 @@ Note: Does not work on-chain. -}
toHaskellRatio :: Rational -> HS.Rational
toHaskellRatio (Rational n d) = n HS.% d

{-# DEPRECATED fromGHC "Use fromHaskellRatio instead" #-}
fromGHC :: HS.Rational -> Rational
fromGHC = fromHaskellRatio
{-# DEPRECATED toGHC "Use toHaskellRatio instead" #-}
toGHC :: Rational -> HS.Rational
toGHC = toHaskellRatio

{- HLINT ignore -}

{- Note [Ratio]
Expand Down