type T' = T a b c

*problem*: given type T with a few parameters e.g. T a b c some functions where this type is passed to, are agnostic to a, b, c i.e. accept T with any of a, b, c processT::T a b c -> () when either number of these parameters or T change (c is dropped or d is added: T a b c d), signatures of every function where T is passed to, need to be updated. *question*: is this possible to specify type synonym T' so that it may be passed to parameter (a,b,c) - agnostic functions so: processT::T' -> () ?

just came across this: https://downloads.haskell.org/~ghc/7.0.3/docs/html/users_guide/data-type-ext... this seems to work: ExistentialQuantification Rank2Types type T' = forall a b. (T a b)

T' and T a b seem to not mix well. T' can not be passed to a function expecting T a b and vice versa any suggestions?

If you want to have something that can ignore a variable, you can just fill
it in with (). T Int Char () (), then have a function :: T a b () () -> IO
(). You can clean it up a little by making type aliases. type T2 a b = T
a b () (), type T3 a b c = T a b c ().
On Mon, Aug 22, 2016 at 7:32 AM, Imants Cekusins
T' and T a b seem to not mix well.
T' can not be passed to a function expecting T a b and vice versa
any suggestions?
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

David, this seem to work similar to forall...: synonym is not compatible with T a b. you see, I hope to mix synonym with original T a b in a chain of fun calls. Some of the funs accept args like this: fun1::T a b -> a -> out1 .. and others - like this: fun2::T' -> out2 in both cases a and b are not set. However in fun1 I try to enforce type 'a' in the arg #2.

Go in the other direction?
data T a b = T a b
type T2 a b c = T a (b, c)
type T3 a b c d = T a (b, c, d)
On Aug 22, 2016 5:40 AM, "Imants Cekusins"
David, this seem to work similar to forall...:
synonym is not compatible with T a b.
you see, I hope to mix synonym with original T a b in a chain of fun calls.
Some of the funs accept args like this: fun1::T a b -> a -> out1
.. and others - like this: fun2::T' -> out2 in both cases a and b are not set. However in fun1 I try to enforce type 'a' in the arg #2.
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners

ok this may be it: data T a = T { a::a, common::Int } type T' a b = T (a,b) # of record fields stays the same however we cram more data into the 'a' field. it surely works. Thank you.
participants (3)
-
David McBride
-
Imants Cekusins
-
Theodore Lief Gannon