Question

There is an extensive collection of unique words in on the Haskell repository, cabal, (very slight exaggeration). Anyway today's term is isolate primitive. What is an isolate primitive? How does it compare to a non-isolate primitive? Unfortunately, I don't have the background to know most of the Haskell parlance, and Google isn't helping much on this one.

The nomenclature that I'm familiar with defines primitive as a type that has no super-type, and I've never seen isolate as a prefix anywhere.

Was it helpful?

Solution

The 'cereal' package provides a primitive function,

isolate :: Int -> Get a -> Get a

which is unique to that package. This function "isolates" a parsing action to operate using a fixed block of bytes. If the parsing function consumes less or more bytes, that is an error.

Thus, as opposed to binary, cereal "introduces an isolate primitive for parser isolation"

OTHER TIPS

Isn't 'isolate' the name of a primitive defined in HackageDB::cereal ?

The isolate parser is called "primitive" because it is a simple parser that:

  • Can't be built from the other, provided parsers (not if it's really primitive).

  • Can be used in combination with other parsers to build more complex parsers.

It's a "primitive parser" in the same way that uint is a primitive type.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top