Skip to content

Instantly share code, notes, and snippets.

@Wizek

Wizek/main.hs Secret

Created May 2, 2018 12:00
Show Gist options
  • Save Wizek/9edf2a96c55cf42572246e55916ba976 to your computer and use it in GitHub Desktop.
Save Wizek/9edf2a96c55cf42572246e55916ba976 to your computer and use it in GitHub Desktop.
{-# LANGUAGE TemplateHaskell, DataKinds, TypeOperators, FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-unticked-promoted-constructors #-}
import Data.Extensible
import Control.Lens hiding ((:>))
mkField "x y"
r = emptyRecord
foo = (x @= 1 <: y @= 2 <: r) == (y @= 2 <: x @= 1 <: r)
{-
main.hs:10:45: error:
• Couldn't match type ‘'Missing "x"’ with ‘'Expecting (n1 ':> v1)’
arising from a use of ‘x’
• In the first argument of ‘(@=)’, namely ‘x’
In the first argument of ‘(<:)’, namely ‘x @= 1’
In the second argument of ‘(<:)’, namely ‘x @= 1 <: r’
|
10 | foo = (x @= 1 <: y @= 2 <: r) == (y @= 2 <: x @= 1 <: r)
| ^
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment