11use std:: {
22 collections:: { BTreeSet , HashMap } ,
3- fmt:: format,
43 net:: Ipv6Addr ,
54 ops:: Deref ,
65} ;
@@ -20,11 +19,11 @@ use pallas_crypto::hash::{Hash, Hasher};
2019use pallas_network:: miniprotocols:: {
2120 handshake:: NetworkMagic ,
2221 localstate:: queries_v16:: {
23- primitives:: Bytes , Anchor , AssetName , BoundedBytes , Constitution , CostModel , CostModels ,
24- DRep , DRepVotingThresholds , DatumHash , DatumOption , ExUnitPrices , FieldedRewardAccount ,
25- GovAction , GovActionId , PParamsUpdate , PlutusData , PolicyId , PoolMetadata ,
26- PoolVotingThresholds , ProposalProcedure , ProtocolVersion , RationalNumber , Relay ,
27- ScriptHash , TransactionInput , TransactionOutput , Value , Vote ,
22+ primitives:: Bytes , Anchor , AssetName , BigInt , BoundedBytes , Constitution , CostModel ,
23+ CostModels , DRep , DRepVotingThresholds , DatumHash , DatumOption , ExUnitPrices ,
24+ FieldedRewardAccount , GovAction , GovActionId , PParamsUpdate , PlutusData , PolicyId ,
25+ PoolMetadata , PoolVotingThresholds , ProposalProcedure , ProtocolVersion , RationalNumber ,
26+ Relay , ScriptHash , TransactionInput , TransactionOutput , Value , Vote ,
2827 } ,
2928 localtxsubmission:: {
3029 primitives:: {
@@ -351,8 +350,8 @@ impl HaskellDisplay for UtxoFailure {
351350 ) ,
352351 MaxTxSizeUTxO ( actual, max) => format ! (
353352 "(MaxTxSizeUTxO {} {})" ,
354- actual. to_haskell_str_p ( ) ,
355- max. to_haskell_str_p ( )
353+ actual. to_haskell_str ( ) ,
354+ max. to_haskell_str ( )
356355 ) ,
357356 InputSetEmptyUTxO => "InputSetEmptyUTxO" . to_string ( ) ,
358357 FeeTooSmallUTxO ( required, provided) => format ! (
@@ -1076,6 +1075,20 @@ impl HaskellDisplay for i64 {
10761075 }
10771076}
10781077
1078+ impl HaskellDisplay for i128 {
1079+ fn to_haskell_str ( & self ) -> String {
1080+ self . to_string ( )
1081+ }
1082+
1083+ fn to_haskell_str_p ( & self ) -> String {
1084+ if * self >= 0 {
1085+ self . to_string ( )
1086+ } else {
1087+ format ! ( "({})" , self )
1088+ }
1089+ }
1090+ }
1091+
10791092impl HaskellDisplay for u8 {
10801093 fn to_haskell_str ( & self ) -> String {
10811094 format ! ( "{}" , self )
@@ -1534,6 +1547,25 @@ impl HaskellDisplay for u64 {
15341547 }
15351548}
15361549
1550+ impl HaskellDisplay for BigInt {
1551+ fn to_haskell_str ( & self ) -> String {
1552+ use BigInt :: * ;
1553+
1554+ match self {
1555+ Int ( i) => {
1556+ let value: i128 = i. 0 . into ( ) ;
1557+ value. to_haskell_str_p ( )
1558+ } ,
1559+ BigNInt ( bb) => {
1560+ format ! ( "BigNInt {}" , bb. to_haskell_str_p( ) )
1561+ }
1562+ BigUInt ( bb) => {
1563+ format ! ( "BigUInt {}" , bb. to_haskell_str_p( ) )
1564+ }
1565+ }
1566+ }
1567+ }
1568+
15371569impl HaskellDisplay for String {
15381570 fn to_haskell_str ( & self ) -> String {
15391571 self . as_text ( )
@@ -2093,21 +2125,12 @@ impl AsDatumHash for DatumHash {
20932125
20942126impl HaskellDisplay for PlutusData {
20952127 fn to_haskell_str ( & self ) -> String {
2096- use pallas_network:: miniprotocols:: localstate:: queries_v16:: BigInt as Big ;
20972128 use PlutusData :: * ;
20982129
20992130 match self {
21002131 Constr ( constr) => constr. fields . to_haskell_str ( ) ,
21012132 Map ( key_value_pairs) => key_value_pairs. to_haskell_str ( ) . to_string ( ) ,
2102- BigInt ( big_int) => match big_int {
2103- Big :: Int ( i) => format ! ( "BigInt Int {}" , i. to_haskell_str( ) ) ,
2104- Big :: BigNInt ( bb) => {
2105- format ! ( "BigNInt {}" , bb. to_haskell_str( ) )
2106- }
2107- Big :: BigUInt ( bb) => {
2108- format ! ( "BigUInt {}" , bb. to_haskell_str( ) )
2109- }
2110- } ,
2133+ BigInt ( big_int) => big_int. to_haskell_str ( ) ,
21112134 BoundedBytes ( bb) => bb. to_haskell_str ( ) ,
21122135 Array ( arr) => format ! ( "Array {}" , arr. to_haskell_str( ) ) ,
21132136 }
@@ -2141,7 +2164,7 @@ where
21412164
21422165impl HaskellDisplay for Int {
21432166 fn to_haskell_str ( & self ) -> String {
2144- format ! ( "Int {}" , self . 0 )
2167+ format ! ( "{}" , self . 0 )
21452168 }
21462169}
21472170
0 commit comments