How can I get the intermediate results from each step of a multi-step pipeline function?

Viewed 217

I have a code which looks like this:

this.GetItemTypeIdsAsListForOneItemTypeIdTreeUpIncludeItemType itemType.AutoincrementedId
|> Array.map (fun i -> i.AutoincrementedId)
|> Array.map (BusinessLogic.EntityTypes.getFullSetOfEntityTypeFieldValuesForItemTypeAid item.Autoincrementedid)
|> Array.fold Array.append [||]
|> Array.map (fun fv -> { fv with ReferenceAutoId = aid } )
|> Array.toSeq
|> Seq.distinctBy (fun fv -> fv.Fieldname)
|> Seq.toArray

Sometimes such code gets the unusual result which I need to explain. Usually there is not error in the code. There is an error in the data. And I need to explain why this backet of data is incorrect. What is the best way to do it ?

I just want to look at the list on each step of this expression.

Something like:

func data
|> func2 && Console.WriteLine
|> func3 && Console.WriteLine
....

Get input, split it on two. Pass one of the output to the next function, and second output to Console.

1 Answers
Related