A Strange Haskell Value (It can be Int and Bool)
I released a Haskell library “has”, for creating type-indexed records in a casual way. Its usage is described here.
I will show another usage of this library. It is too trivial to write in documentation but attracting to me in its strangeness:
{-# LANGUAGE TypeFamilies,TypeOperators,FlexibleContexts #-}
import Data.Has
data Any = Any
intBool = prjl Any (Any .> (42::Int) & Any .> True)
test :: Int
test = if intBool then intBool + 5 else 0
I noticed “has” can be used in this way while reading the paper about type-indexed records (I forgot the title and the author of the paper…)
This intBool can be made with other type-indexed record libraries.
The point is to make a generic label over any types of values.