I have included cardano-prelude as a dependency in my project's cabal.project file: https://github.com/omefire/api-server/blob/main/cabal.project
However, when I try to build the project with cabal build, I always end up getting this error:
...
[ 7 of 14] Compiling Cardano.Prelude.GHC.Heap ( src/Cardano/Prelude/GHC/Heap.hs, dist/build/Cardano/Prelude/GHC/Heap.o, dist/build/Cardano/Prelude/GHC/Heap.dyn_o )
[ 8 of 14] Compiling Cardano.Prelude.HeapWords ( src/Cardano/Prelude/HeapWords.hs, dist/build/Cardano/Prelude/HeapWords.o, dist/build/Cardano/Prelude/HeapWords.dyn_o )
[ 9 of 14] Compiling Cardano.Prelude.Json.Parse ( src/Cardano/Prelude/Json/Parse.hs, dist/build/Cardano/Prelude/Json/Parse.o, dist/build/Cardano/Prelude/Json/Parse.dyn_o )
[10 of 14] Compiling Cardano.Prelude.Json.Canonical ( src/Cardano/Prelude/Json/Canonical.hs, dist/build/Cardano/Prelude/Json/Canonical.o, dist/build/Cardano/Prelude/Json/Canonical.dyn_o )
src/Cardano/Prelude/Json/Canonical.hs:110:14: error:
• Could not deduce (Buildable e2)
arising from a use of ‘parseJSString’
from the context: ReportSchemaErrors m
bound by the instance declaration
at src/Cardano/Prelude/Json/Canonical.hs:109:10-50
The type variable ‘e2’ is ambiguous
These potential instances exist:
instance Buildable Void -- Defined in ‘Formatting.Buildable’
instance Buildable IntPtr -- Defined in ‘Formatting.Buildable’
instance Buildable WordPtr -- Defined in ‘Formatting.Buildable’
...plus 24 others
...plus 12 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: parseJSString (readEither . toS)
In an equation for ‘fromJSON’:
fromJSON = parseJSString (readEither . toS)
In the instance declaration for ‘FromJSON m Word64’
|
110 | fromJSON = parseJSString (readEither . toS)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Cardano/Prelude/Json/Canonical.hs:110:29: error:
• Could not deduce (Protolude.Conv.StringConv e2 GHC.Base.String)
arising from a use of ‘readEither’
from the context: ReportSchemaErrors m
bound by the instance declaration
at src/Cardano/Prelude/Json/Canonical.hs:109:10-50
The type variable ‘e2’ is ambiguous
These potential instances exist:
instance Protolude.Conv.StringConv ByteString GHC.Base.String
-- Defined in ‘Protolude.Conv’
instance Protolude.Conv.StringConv LB.ByteString GHC.Base.String
-- Defined in ‘Protolude.Conv’
instance Protolude.Conv.StringConv Text GHC.Base.String
-- Defined in ‘Protolude.Conv’
...plus one other
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘(.)’, namely ‘readEither’
In the first argument of ‘parseJSString’, namely
‘(readEither . toS)’
In the expression: parseJSString (readEither . toS)
|
110 | fromJSON = parseJSString (readEither . toS)
| ^^^^^^^^^^
src/Cardano/Prelude/Json/Canonical.hs:110:42: error:
• Could not deduce (ConvertText Text e2)
arising from a use of ‘toS’
from the context: ReportSchemaErrors m
bound by the instance declaration
at src/Cardano/Prelude/Json/Canonical.hs:109:10-50
The type variable ‘e2’ is ambiguous
These potential instances exist:
instance [safe] ConvertText Text Text
-- Defined in ‘Protolude.ConvertText’
instance [safe] ConvertText Text GHC.Base.String
-- Defined in ‘Protolude.ConvertText’
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the second argument of ‘(.)’, namely ‘toS’
In the first argument of ‘parseJSString’, namely
‘(readEither . toS)’
In the expression: parseJSString (readEither . toS)
|
110 | fromJSON = parseJSString (readEither . toS)
| ^^^
src/Cardano/Prelude/Json/Canonical.hs:113:14: error:
• Could not deduce (Buildable e1)
arising from a use of ‘parseJSString’
from the context: ReportSchemaErrors m
bound by the instance declaration
at src/Cardano/Prelude/Json/Canonical.hs:112:10-51
The type variable ‘e1’ is ambiguous
These potential instances exist:
instance Buildable Void -- Defined in ‘Formatting.Buildable’
instance Buildable IntPtr -- Defined in ‘Formatting.Buildable’
instance Buildable WordPtr -- Defined in ‘Formatting.Buildable’
...plus 24 others
...plus 12 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: parseJSString (readEither . toS)
In an equation for ‘fromJSON’:
fromJSON = parseJSString (readEither . toS)
In the instance declaration for ‘FromJSON m Integer’
|
113 | fromJSON = parseJSString (readEither . toS)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Cardano/Prelude/Json/Canonical.hs:113:29: error:
• Could not deduce (Protolude.Conv.StringConv e1 GHC.Base.String)
arising from a use of ‘readEither’
from the context: ReportSchemaErrors m
bound by the instance declaration
at src/Cardano/Prelude/Json/Canonical.hs:112:10-51
The type variable ‘e1’ is ambiguous
These potential instances exist:
instance Protolude.Conv.StringConv ByteString GHC.Base.String
-- Defined in ‘Protolude.Conv’
instance Protolude.Conv.StringConv LB.ByteString GHC.Base.String
-- Defined in ‘Protolude.Conv’
instance Protolude.Conv.StringConv Text GHC.Base.String
-- Defined in ‘Protolude.Conv’
...plus one other
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘(.)’, namely ‘readEither’
In the first argument of ‘parseJSString’, namely
‘(readEither . toS)’
In the expression: parseJSString (readEither . toS)
|
113 | fromJSON = parseJSString (readEither . toS)
| ^^^^^^^^^^
src/Cardano/Prelude/Json/Canonical.hs:113:42: error:
• Could not deduce (ConvertText Text e1)
arising from a use of ‘toS’
from the context: ReportSchemaErrors m
bound by the instance declaration
at src/Cardano/Prelude/Json/Canonical.hs:112:10-51
The type variable ‘e1’ is ambiguous
These potential instances exist:
instance [safe] ConvertText Text Text
-- Defined in ‘Protolude.ConvertText’
instance [safe] ConvertText Text GHC.Base.String
-- Defined in ‘Protolude.ConvertText’
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the second argument of ‘(.)’, namely ‘toS’
In the first argument of ‘parseJSString’, namely
‘(readEither . toS)’
In the expression: parseJSString (readEither . toS)
|
113 | fromJSON = parseJSString (readEither . toS)
| ^^^
src/Cardano/Prelude/Json/Canonical.hs:116:14: error:
• Could not deduce (Buildable e0)
arising from a use of ‘parseJSString’
from the context: MonadError SchemaError m
bound by the instance declaration
at src/Cardano/Prelude/Json/Canonical.hs:115:10-55
The type variable ‘e0’ is ambiguous
These potential instances exist:
instance Buildable Void -- Defined in ‘Formatting.Buildable’
instance Buildable IntPtr -- Defined in ‘Formatting.Buildable’
instance Buildable WordPtr -- Defined in ‘Formatting.Buildable’
...plus 24 others
...plus 12 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: parseJSString (readEither . toS)
In an equation for ‘fromJSON’:
fromJSON = parseJSString (readEither . toS)
In the instance declaration for ‘FromJSON m Natural’
|
116 | fromJSON = parseJSString (readEither . toS)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Cardano/Prelude/Json/Canonical.hs:116:29: error:
• Could not deduce (Protolude.Conv.StringConv e0 GHC.Base.String)
arising from a use of ‘readEither’
from the context: MonadError SchemaError m
bound by the instance declaration
at src/Cardano/Prelude/Json/Canonical.hs:115:10-55
The type variable ‘e0’ is ambiguous
These potential instances exist:
instance Protolude.Conv.StringConv ByteString GHC.Base.String
-- Defined in ‘Protolude.Conv’
instance Protolude.Conv.StringConv LB.ByteString GHC.Base.String
-- Defined in ‘Protolude.Conv’
instance Protolude.Conv.StringConv Text GHC.Base.String
-- Defined in ‘Protolude.Conv’
...plus one other
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘(.)’, namely ‘readEither’
In the first argument of ‘parseJSString’, namely
‘(readEither . toS)’
In the expression: parseJSString (readEither . toS)
|
116 | fromJSON = parseJSString (readEither . toS)
| ^^^^^^^^^^
src/Cardano/Prelude/Json/Canonical.hs:116:42: error:
• Could not deduce (ConvertText Text e0)
arising from a use of ‘toS’
from the context: MonadError SchemaError m
bound by the instance declaration
at src/Cardano/Prelude/Json/Canonical.hs:115:10-55
The type variable ‘e0’ is ambiguous
These potential instances exist:
instance [safe] ConvertText Text Text
-- Defined in ‘Protolude.ConvertText’
instance [safe] ConvertText Text GHC.Base.String
-- Defined in ‘Protolude.ConvertText’
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the second argument of ‘(.)’, namely ‘toS’
In the first argument of ‘parseJSString’, namely
‘(readEither . toS)’
In the expression: parseJSString (readEither . toS)
|
116 | fromJSON = parseJSString (readEither . toS)
| ^^^
cabal: Failed to build cardano-prelude-0.1.0.0 (which is required by
exe:api-server-exe from api-server-0.1.0.0). See the build log
above for details.
I tried this on Mac and Linux and got the same result.
How do I get past this issue?
cabal.project
file should contain the sameindex-state
line as the one incardano-node
. That may help