haskell - How can i find an item in a list then return its pair? -


this question has answer here:

i have list, [('a',1),('b',2),..] i'd key value search. found lookup returns 'maybe int'. there function returns value key, , gives normal int back?

what should function in case key not in list?

if sure key in list, then

import data.maybe 

and run result (i.e. maybe int) through fromjust. you'll plain int, , when key not in list you'll exception.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -