Menu

Programming Language Haskell Trav Function Runs Container Outputs Content Given Index Inde Q43854105

Programming Language is Haskell

The trav function runs through a container and outputs thecontent of the given index. If the index does not exist, Nothing isoutput.

class Trav t where type Index t :: * trav :: ta -> Index t -> Maybe a

Instantiate Trav for the following data types.

1.) Map k a – Returns the element for the specified key.

Example: trav (Map.fromList [(“asd”, 1), (“dsa”, 2)]) “asd”-> Just 1

class Trav t where type Index t :: * trav :: ta -> Index t -> Maybe a Show transcribed image text class Trav t where type Index t :: * trav :: ta -> Index t -> Maybe a

Expert Answer


Answer to Programming Language is Haskell The trav function runs through a container and outputs the content of the given index. …

OR