polymorphism - Coerce to multiple-parameter type in Haskell -
I have a type My main question is: How do I define a variable in a particular should do? Something like this: (I think) The question is: right What is After syntax I am getting the error Besides, I'm looking for a better way to implement it. In particular, I really want to estimate I have tried so far: First note Data type references, such as: Generally a bad idea and has retired from language. Do not ignore it To make an example, you need to type the Data Constructor But this is not enough, so far the type of guess would be Back to the first note However, maybe you wanted to: And every function that creates or consumes a polywier can apply the necessary obstacles: class IntegerAsType one where the value :: a -> Integer data T5 example IntegerAsType T5 where value_ = 5 newtype (number one, integer type n) = & gt; PolyRing A = PolyRing [A]
PolyRing
x = [1, 2, 3] :: integer T5
:: ?
with the actual type the required type can not be matched with the 'PolyRing Integer T5' In the expression '[t0]': [1, 2, 3] :: PolyRing integer for T5 'x in an equation': x = [1, 2, 3] :: PolyRing integer T5
should specify integerAsType n (this should not depend on the length of the list , Even if it is possible).
x = [1,2,3] :: polyring (integer, t5) x = [1,2,3 ] :: PolyRing Integer T5
newtype (number one, integer type n) = & gt; PolyRing A = Polarizing [A]
PolyRing :
PolyRing [1,2,3]
(IntegerAsType n) = & gt; PolyRing integer n your last type of signature will terminate it
two x = polarizing [1,2,3] :: Integration for T5.
newtype PolyRing a = PolyRing [a ]
func :: (name one, integer type N) = & gt; Polarizing a n - & gt; ...
Comments
Post a Comment