import Data.Bits
args value list = foldr f 0 $ zip (reverse list) [0..]
where
f x (a,b)
| testBit value a = setBit x 1
| otherwise = clearBit x 1
main = print $ args 12 [1,2,3]
По замыслу функция дожна вынимать из value биты с указынными номерами, и формировать из них новое число. В лист порядок битов обратный.
Вывод ошибки
No instance for (Bits (Int, t))
arising from a use of `args' at main.hs:15:15-29
Possible fix: add an instance declaration for (Bits (Int, t))
In the second argument of `($)', namely `args 12 [1, 2, 3]'
In the expression: print $ args 12 [1, 2, 3]
In the definition of `main': main = print $ args 12 [1, 2, 3]