hunt-framework / hunt

A flexible, lightweight search platform
59 stars 10 forks source link

Newtype wrapper for Description #63

Closed chrisreu closed 10 years ago

chrisreu commented 10 years ago

The documents description is a type right now - but it should be a newtype. We define the Description as a strict map, but the type does not enforce the strict usage throughout the application.

type Description  = SM.Map Text Text   

For example: If i create a document with a description somewhere in the code, but import the lazy Map there - the description is lazy in that particular case and we get no compiler error.

With a newtype wrapper we could control the usage of strict functions and avoid potential memory leaks.