Skip to content

Commit 0cab1a5

Browse files
MazMatthijsBlom
andauthored
feat: remove illogical sentence (#56)
* feat: remove illogical sentence * feat: maintain continuity w/ between sentences Co-authored-by: Matthijs <19817960+MatthijsBlom@users.noreply.github.com> Signed-off-by: Maz <m47h4r@gmail.com> --------- Signed-off-by: Maz <m47h4r@gmail.com> Co-authored-by: Matthijs <19817960+MatthijsBlom@users.noreply.github.com>
1 parent f889d3b commit 0cab1a5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

markdown/source_md/types-and-typeclasses.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,7 @@ It has a type declaration of `fromIntegral :: (Num b, Integral a) => a -> b`.
424424
From its type signature we see that it takes an integral number and turns it into a more general number.
425425
That's useful when you want integral and floating point types to work together nicely.
426426
For instance, the `length` function has a type declaration of `length :: [a] -> Int` instead of having a more general type of `(Num b) => length :: [a] -> b`.
427-
I think that's there for historical reasons or something, although in my opinion, it's pretty stupid.
428-
Anyway, if we try to get a length of a list and then add it to `3.2`, we'll get an error because we tried to add together an `Int` and a floating point number.
427+
If we try to get a length of a list and then add it to `3.2`, we'll get an error because we tried to add together an `Int` and a floating point number.
429428
So to get around this, we do `fromIntegral (length [1,2,3,4]) + 3.2` and it all works out.
430429

431430
Notice that `fromIntegral` has several class constraints in its type signature.

0 commit comments

Comments
 (0)