Boil the macaroni in salted water and drain.
Fry the chopped onion until well browned.
Using a blender or food processor, chop the hazelnuts along with the milk, the flour and soy sauce. Add to the onion and cook for 10 minutes.
Mix the macaroni together with the hazelnut sauce and the cranberries.
Transfer everything to an ovenproof dish, top with the cheese and brown under the grill before serving.