I'm new to F# and trying to rewrite one of our applications in F# to try and learn it along the way and I am having a bit of trouble flattening a list. I have searched and found several answers, but I can't seem to get any of them to work.
My data type is saying it is val regEntries: RegistryKey list list
I would like it to only be one list.
Below is my code:
namespace DataModule
module RegistryModule =
open Microsoft.Win32
let regEntries =
["SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"
"SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"]
|> List.map (fun x -> Microsoft.Win32.Registry.LocalMachine.OpenSubKey(x))
|> List.map (fun k ->
List.ofArray (k.GetSubKeyNames())
|> List.map (fun x -> k.OpenSubKey(x))
|> List.filter (fun x -> x.GetValue("ProductId") <> null))