Help needed: Type mismatch error

29 views
Skip to first unread message

Răzvan Rotaru

unread,
Mar 4, 2015, 4:28:04 PM3/4/15
to yeti...@googlegroups.com
Hi,

I can't seem to be able to define following function:

getBindings e = (
    b
= "binding" ^ e.text;
    childrenBindings
= map getBindings e.elements;
   
if b == "binding" then
        b
:: childrenBindings
   
else:
        childrenBindings
   
);


The compilation error is:

Function type ('a is {.elements is list?<'a>, .text is string}) -> list<string> is not ('a is {.elements is list?<'a>, .text is string}) -> string (self-binding)
Type mismatch: list<string> is not string

Is there a mistake in the function which I am not seeing, or is this really not possible in yeti?

Thanks,
Răzvan

chrisichris

unread,
Mar 4, 2015, 5:22:30 PM3/4/15
to yeti...@googlegroups.com
The getBindings functions returns a list<string> but the 'map' function expects a functiong which returns just a string. 

I thing if you replace the 'map' on line 3  with 'concatMap' (http://dot.planet.ee/yeti/docs/latest/yeti.lang.std.html#concatMap) than it works. I have not tested it so. 
Reply all
Reply to author
Forward
0 new messages