The launchMissilesAt example would in F# be something like:
type Country = BigEnemy | MediumEnemy | PunyEnemy | TradePartner | Ally | BestAlly
let launchMissilesAt country =
printfn "bombed %A" country
(*
GFunc
type GFunc<'R> =
abstract Invoke : 'T -> 'R
*)
// inspired by GFunc
type ElementPicker =
abstract Pick : 'T list -> 'T
let g =
{new ElementPicker with
member this.Pick(xs) = xs |> List.head } // or something alike
//let g =
// {new ElementPicker with
// member this.Pick(_) = BestAlly }
//This expression was expected to have type
// ''a'
//but here has type
// 'Country'
let f = launchMissilesAt <| g.Pick [BigEnemy; MediumEnemy; PunyEnemy]