diff --git a/docs/examples/polymorphism.mdx b/docs/examples/polymorphism.mdx new file mode 100644 index 0000000..479ddde --- /dev/null +++ b/docs/examples/polymorphism.mdx @@ -0,0 +1,30 @@ +--- +sidebar_position: 2 +--- + +import { Hidden } from "@site/src/components/Hidden"; + +# Polymorphism + +_By Kaz, July 2023 + +## Types + +What is the type of `f`? + +```sml +fun f ([],[]) = f ([],[]) ^ "A" + | f (_,_) = f (_,_) ^ "A" +``` + + + Type: ('a list * 'b list) -> string
+ + For a surprise, try putting the above function in the REPL! +
+ + + + + +