Reputation: 43
I have a problem and cannot find out what it is. I have reindented again over and over, but cannot find the solution. Is there something else this can be dependent on?
Code:
type Triple = (Prime, Quot, Gen)
correctness :: Triple -> Bool
correctness (p,q,g) = prime && pLength && qLength && divisor && orderq
where prime = probablyPrime n 5
qLength = q < 2^1024
pLength = p < 2^160
divisor = (p-1 `mod` q) == 0
orderq = (g^q mod p == 1) && (g > 1)
Error Message (line 94 corresponds to "correctness :: Triple -> Bool"):
crypt.hs:94:0: parse error (possibly incorrect indentation)
EDIT: I solved the problem. The problem was a syntax error in an above function. I had otherwise m_ify m*2
instead of otherwise = m_ify m*2
Upvotes: 1
Views: 1351
Reputation: 60513
Worksforme, jumps right into the type errors.
Is line 92 the
type Triple = (Prime, Quot, Gen)
line, or did you move that from somewhere else? Sometimes errors can show up with a line number later than where they actually occur. I would check for mismatched parentheses above line 92 (probably nearby).
And on some occasions an invisible unicode character seems to sneak into my code. Retyping has occasionally worked.
Upvotes: 1
Reputation: 139058
You might just need to add backticks around the mod
in the final line. This wouldn't cause the indentation error you report, but the following compiles for me:
n = undefined
probablyPrime = undefined
type Prime = Int
type Quot = Int
type Gen = Int
type Triple = (Prime, Quot, Gen)
correctness :: Triple -> Bool
correctness (p,q,g) = prime && pLength && qLength && divisor && orderq
where prime = probablyPrime n 5
qLength = q < 2^1024
pLength = p < 2^160
divisor = (p-1 `mod` q) == 0
orderq = (g^q `mod` p == 1) && (g > 1)
The only change here (apart from the first five lines) is in the last line.
Upvotes: 1
Reputation: 21837
Try:
type Triple = (Prime, Quot, Gen)
correctness :: Triple -> Bool
correctness (p,q,g) = prime && pLength && qLength && divisor && orderq
where
prime = probablyPrime n 5
qLength = q < 2^1024
pLength = p < 2^160
divisor = (p-1 `mod` q) == 0
orderq = (g^q mod p == 1) && (g > 1)
Read - http://www.haskell.org/onlinereport/syntax-iso.html - 9.3 Layout
Upvotes: 0