i have 2 arrays of different types , 1) moduleinfo
array has each element of type
{name :: string, pack :: string }
and 2) string
array. simple string
array contains element thats similar name
filed of moduleinfo
type, i.e string. simple string
array sorted not moduleinfo
array.
now how write function sort moduleinfo
array based on order of simple string
array. given name
field in moduleinfo
match simple string
array elements.
also function shall return sorted array of moduleinfo
type
i suggest sort moduleinfo
directly:
sortedmoduleinfo = sortwith (\(module name1 pack1) (module name2 pack2) -> compare name1 name2) moduleinfo
here assume have declared type named module
name
, pack
elements showed in question.
Comments
Post a Comment