Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell token "#"

Tags:

haskell

What does the # token mean and how is it used?

newtype IO a = IO (State# RealWorld -> (# State# RealWorld, a #))

I came across this here and wonder where this type is actually defined or weather this is some syntax of a internal type that is ultimately defined in C?

like image 834
Konrad Eisele Avatar asked May 04 '19 11:05

Konrad Eisele


Video Answer


1 Answers

The # marks the type as an unboxed type. The # is conventional, but requires an extension (MagicHash) to make it valid syntax. Likewise, (# ... #) is the syntax for an unboxed tuple.

like image 56
chepner Avatar answered Nov 11 '22 05:11

chepner