haskell,collatz,type-signature

The problem is, (/) needs a Fractional, like float, whereas, even and odd need Integrals.... Basically, the concept of even and odd don't make sense with fractionals (ie- is 1.5 odd or even?). Since you know that n is even in the second case, you can replace (/) with quot,...

The (!!) list indexing operator only takes Ints, while your primes list contains Integers, so your signature needs to be p007nthPrime :: Int -> Integer Both Int and Integer are types of the class Integral, but a single type cannot be both Int and Integer. If you need the argument...

haskell,types,typeclass,type-signature

There is (if we neglect unboxed types) only one kind whose types actually have any values: *. All other kinds don't contain types as such, but just "type-level entities". The compiler can use those to determine what to do with the actual types and their values around, but it's never...

If you use a in the c2i signature, then it has to work with any a. In other words, a is chosen by the caller of your function. Concretely, it has to work with c2i :: Church String -> Int -- that is c2i :: ((String -> String) -> String...

ok this will work: average :: Integral a => [a] -> a average ns = sum ns `div` (fromIntegral $ length ns) please note that div :: Integral a => a -> a -> a so you need Integral a instead of just Num a (which has no division) And...

The "99 Problems" set was, as I understand it, written for Prolog originally, and then translated to Lisp. It was then ... ah ... transliterated to Haskell. Unfortunately, things that make sense in Lisp don't always make so much sense in Haskell, so taking the problem descriptions too literally will...

haskell,types,monads,type-signature

The type signature of forever is crafted to suggest that its result runs forever. Specifically, there is no way to write an action of type m b (polymorphic in its return value) that terminates and yields a non-bottom value. An alternative way to suggest the same thing would be forever'...

haskell,vector,monads,type-signature

You're almost there. You're expected type signature is correct except the resulting MVector needs to be in the monad m: vecFromList :: PrimMonad m => [t] -> Int -> m (MV.MVector (PrimState m) t) The fillV function should have type fillV :: [(Int, t)] -> MV.MVector (PrimState m) t ->...

You have a typo. [Should] be (Eq a) =>... (arrow should be made with equal sign) – Michal Seweryn Class constraints are separated from the types they constrain with =>....