Error with functions inside tuples in Haskell

I play a bit with Haskell and I am stuck with this error using the snd function with a tuple (String, list).

snd ("Felix Felices",[("Escarabajos Machacados",52,[f1,f2]),("Ojo de Tigre Sucio",2,[f2])])
ERROR - Cannot find "show" function for:
*** Expression : snd ("Felix Felices",[("Escarabajos Machacados",52,[f1,f2]),("Ojo de Tigre Sucio",2,[f2])])
*** Of type    : [([Char],Integer,[(Integer,Integer,Integer) -> (Integer,Integer,Integer)])]

The fact is that if I delete f1, f2 and f3 (they are functions), the code works just fine, it returns a list. Why is this happening, why can't I just put the function inside the second position of the tuple?

+3
source share
4 answers

. - ghci show . show ( ) ? , , , (, , - , , , ). -, ghci.

+5

f1 f2 f3, , , Show, . :

Prelude> snd ("Felix Felices",[("Escarabajos Machacados",52,["f1","f2"]),("Ojo de Tigre     Sucio",2,["f2"])])

:

[("Escarabajos Machacados",52,["f1","f2"]),("Ojo de Tigre Sucio",2,["f2"])]

, , , , , .

+4

module Text.Show.Functions instance Show (a -> b).

ghci> :m +Text.Show.Functions
ghci> [(*), (/)]
[<function>,<function>]

, , , (, vacuum ). Show , .

+3

Haskell, "". ,

> sqrt

, ([ Char], , [(, , ) → (, , )])], , .

0

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


All Articles