From 88055cd0208f07cddfb73fcf4bf8828ac524f682 Mon Sep 17 00:00:00 2001 From: David Chambers Date: Sat, 6 Apr 2019 21:31:52 +0200 Subject: [PATCH] types: update type of Function type constructor --- index.js | 6 +++++- test/index.js | 10 +++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index d660dcf..562cbef 100644 --- a/index.js +++ b/index.js @@ -2810,7 +2810,11 @@ Descending: fromUncheckedUnaryType (Descending), Either: fromUncheckedBinaryType (Either_), Error: Error_, - Function: def ('Function') ({}) ([Array_ (Type), Type]) (Function_), + Function: + def ('Function') + ({}) + ([NonEmpty (Array_ (Type)), Type]) + (Function_), HtmlElement: HtmlElement, Identity: fromUncheckedUnaryType (Identity), Maybe: fromUncheckedUnaryType (Maybe), diff --git a/test/index.js b/test/index.js index 8e958ba..7af7e90 100644 --- a/test/index.js +++ b/test/index.js @@ -1553,9 +1553,13 @@ See https://github.com/sanctuary-js/sanctuary-def/tree/v${version}#Array2 for in }); test ('provides the "Function" type constructor', () => { - eq (($.Function ([a, a])).name) (''); - eq (($.Function ([a, a])).url) (''); - eq (($.Function ([a, a])).supertypes) ([$.AnyFunction]); + eq (typeof $.Function) ('function'); + eq ($.Function.length) (1); + eq (show ($.Function)) ('Function :: NonEmpty (Array Type) -> Type'); + eq (show ($.Function ([a, b]))) ('(a -> b)'); + eq (($.Function ([a, b])).name) (''); + eq (($.Function ([a, b])).url) (''); + eq (($.Function ([a, b])).supertypes) ([$.AnyFunction]); }); test ('provides the "HtmlElement" type', () => {