Haskell finding the length of a list from another equation -


Then I have an equation that returns an int given list, I want to put it in another equation That to see if the length is equal to one or two and it is true that if this length is one and is wrong, then it is not.

  con :: int -> [Int] - & gt; Bool Let's get list x | Length x == 1 = true |  

The closest I can find here, but it throws the error

  error - can not be found for the "show" function: ** * Expression: Con 3 *** Type: [int] - & gt; Bool  

The cause of the error

The cause of the error is the fact From that your con is the type:

  int -> [Int] - & gt; Bool  

which means that it is respectively two argument (list of type int and int respectively) Is needed) to return a bullion.

Now, the expression applies to con 3 from 3 to con (supply of an argument), a function Returns the list of int s and returns Bool .

The type of this function is [int] ->

What do you mean

you don ...

You do not need getST , so you can use it Are:

  con :: [a] - & gt; Bull Conn = (== 1) Length  

A list is given for a list so that a bull return: If the length of the list is 1 is return value is true and incorrect otherwise.

If you just want to pass the length of the list, then things should be too simple:

  thief :: int -> Bull Con = (== 1)  


Comments