import Data.Text (Text)
data Address = Address
{ addressCity :: !Text }
What is the purpose of the !?
Based on: https://www.fpcomplete.com/haskell/tutorial/lens/.
import Data.Text (Text)
data Address = Address
{ addressCity :: !Text }
What is the purpose of the !?
Based on: https://www.fpcomplete.com/haskell/tutorial/lens/.
It's a strictness annotation. Data constructor fields with an ! will be strictly evaluated.
Another place you often see this is when using the BangPatterns language extension. You can cause the function to strictly evaluate by annotating the parameter with an ! e.g.
foo :: Num a => a -> b
foo !a = ((++) a 1)