1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
-module(recursive_types3). -export([test/1]). -record(tree, {node :: atom(), kid = nil :: 'nil' | tree()}). -type tree() :: #tree{}. -spec test(tree()) -> tree(). test(Tree) -> case Tree of #tree{node = root, kid=#tree{}} -> Tree end.