XTLang doesn't have a very good 'unsigned' story at the moment. The simple answer is that we expect everything to be signed and conversion from unsigned is an exercise left to the reader.
The slightly more complicated answer is that for many internal operations we don't actually care if the data is signed or unsigned, this is true for multiplication, addition and subtraction. We also support a number of conversion routines with support for unsigned variants: ui64tod for example converts unsigned i64 to double and dtoui64 to go back. Nonetheless, unsigned is a second class citizen at best, and we should do better :)
ADTs: First thing, you found a bug, thanks :) It's now fixed in HEAD. ADTs in XTLang are brand spanking new and are guaranteed to have some teething problems. To my knowledge you are only the second person to actually try to use them :)
I think the examples below (and the bug fix) will answer all your question. Note that you'll need to latest from git for this to work.
;; load in ADT support
(sys:load "libs/base/adt.xtm")
;;
;; an ADT List for our use in this example
;;
(bind-data List{!a}
(Nil)
(Cons !a List{!a}*))
(bind-func map:[List{!b}*,[!b,!a]*,List{!a}*]*
(lambda (f F)
(Cons$ F (x xs)
(Cons (f x) (map f xs)) ;; F did match Cons
(Nil)))) ;; F did not match Cons
(bind-func print:[void,List{!a}*]*
(lambda (lst)
(map (lambda (x) (printout x " ") x) lst)
void))
;; list macro
(define (_List ast)
(if (null? ast)
`(Nil)
`(Cons ,(car ast) ,(_List (cdr ast)))))
;; xtlang macro
(bind-macro (List . ast) (_List ast))
;;
;; enumerate the THINGS
;;
(bind-data Thing (Shoe) (Ship) (King))
;; overload print for Thing
(bind-func print
(lambda (x:Thing*)
(Shoe$ x () (printout "Shoe") void) ;; printout returns void
(Ship$ x () (printout "Ship") void) ;; so fail case
(King$ x () (printout "King") void) ;; must also return void
void))
(bind-func test_the_things
(lambda ()
(let ((shoe (Shoe))
(ship (Ship))
(king (King)))
(List shoe ship king))))
($ (println (test_the_things)))
;; or more directly
($ (println (List (King) (Ship) (Shoe))))
;;
;; Constainers of (non generic) Stuff
;;
(bind-data Container
(CShoe float)
(CShip i32)
(CKing i64 double))
;; overload print for Thing
(bind-func print
(lambda (c:Container*)
(CShoe$ c (x) (printout "<Shoe:" x ">") void)
(CShip$ c (x) (printout "<Ship:" x ">") void)
(CKing$ c (x y) (printout "<King:" x "," y ">") void)
void))
(bind-func test_the_typed_stuff
(lambda ()
(let ((shoe (CShoe 1.0))
(ship (CShip 2))
(king (CKing 3 4.0)))
(List shoe ship king))))
($ (println (test_the_typed_stuff)))
;;
;; Constainers of generic Stuff
;;
(bind-data GContainer{!a,!b}
(GCShoe !a)
(GCShip !b)
(GCKing !a !b))
;; overload print for Thing
(bind-func print:[void,GContainer{!a,!b}*]*
(lambda (c)
(GCShoe$ c (x) (printout "<Shoe:" x ">") void)
(GCShip$ c (x) (printout "<Ship:" x ">") void)
(GCKing$ c (x y) (printout "<King:" x "," y ">") void)
void))
;; this might take some time to compile :(
(bind-func test_the_generic_stuff
(lambda ()
(let ((shoe (GCShoe 1))
(ship (GCShip 2.0))
(king (GCKing 3 4.0))
(shoe2 (GCShoe 'A')) ;; literal string
(ship2 (GCShip 'B)) ;; literal symbol
(king2 (GCKing 'C' 'D)))
(println 'List_1 (List shoe ship king))
(println 'List_2 (List king2 ship2 shoe2))
void)))
($ (test_the_generic_stuff))