liveBook · Manning

Eq

Eq is a type-level interface or trait that specifies or provides equality comparison for values of a type.

How 2 Manning books explain it

Type-Driven Development with Idris

An Idris interface whose methods specify equality and inequality comparisons for a type.

How it is used
Constrains generic functions to types that support equality and inequality comparisons.
How deep it goes
Works through a missing-implementation error, a constrained function, and a custom interface implementation.
Examples
Uses list occurrence counting, a Matter implementation, and an exercise comparing Shape values.
What you can do after
Apply Eq in Idris to constrain generic functions and implement comparisons for custom types.

Read how Type-Driven Development with Idris explains Eq →

Learn Haskell by Example

Eq is a Haskell type class defining equality and inequality operations for values that can be compared.

How it is used
Uses equality constraints to implement membership checks and graph operations over arbitrary comparable values.
How deep it goes
Defines both methods, instance requirements, type restrictions, and constrained container instances, but does not detail equality algorithms.
Examples
Demonstrates GHCi inspection, associative-list membership, graph node lookup, and Eq instances for primitive and container types.
What you can do after
Apply it via Eq constraints to write functions that compare values and search associative lists or graph structures.

Read how Learn Haskell by Example explains Eq →

Also covered in

What to know first

Related concepts

Questions about Eq

What is Eq?

Eq is a type-level interface or trait that specifies or provides equality comparison for values of a type.

Which Manning books explain Eq?

Type-Driven Development with Idris and Learn Haskell by Example.

What should I know before learning Eq?

Manning books that teach Eq usually introduce generics first.

What is Eq a kind of?

Eq is a kind of Idris interface. An Idris interface specifies generic operations that can have implementations for different types.

What are the parts of Eq?

Eq includes method.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.