Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[Haskell] Help

Name: Anonymous 2013-07-15 3:49

I need to write the function that has the P -> P type where the type P means prime numbers. There is the question: how to define P in haskell?

Name: Anonymous 2013-07-15 3:57


isPrime :: Num a => a -> Bool
...

function :: Num a => a -> a
function n
    | not $ isPrime n = error "not a prime"
    | otherwise       = ...

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List