How to write an identity function in haskell

I have a function with a type like this:

functionX :: [String] -> ([Integer] -> [Integer])

This is similar to a mapping function that matches a specific string for a function to a type. Because I need to process the call function X [], which, it seems to me, returns this call, called the identification function, or something else, how can I write it?

+3
source share
1 answer

idis predefined as a function of identification in haskell. He has a type id :: a -> a.

If you would like, you could easily define your own:

myIdentityFunction :: a -> a
myIdentityFunction a = a
+6
source

Source: https://habr.com/ru/post/1752941/


All Articles