Can F# discriminated union types use generics not defined in the type signature?

Viewed 69

I'm new to F# and I'm trying to get something like this to work:

type transform<'a, 'b> = 'a -> 'b

type transformPipeline<'a, 'b> =
  | SingleStep of transform<'a, 'b>
  | MultiStep of (transformPipeline<'a, 'c> * transform<'c, 'b>)

This currently doesn't compile, it says The type parameter 'c is not defined. All I'm trying to do here is chain together these pipelines so that I'm guaranteed the intermediary type 'c can be passed to the transform on the right, but I can't figure out how to communicate this to the type system. Any ideas?

0 Answers
Related