views:

131

answers:

4

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.

+2  A: 

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

kriss
Oho, so the typo is missing backticks around isolate.
Reid Barton
This might just be it, I assumed it was a esoteric term that I just didn't know.
Evan Carroll
where does it define in the source isolate?
Evan Carroll
+4  A: 

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"

Don Stewart
A: 

It's a cruel, cruel inside joke unfortunately. :(

+2  A: 

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.

Jason Dusek