Created
September 22, 2020 20:37
-
-
Save i-am-tom/7de3e07279026e73f9cf68737b8ca6be to your computer and use it in GitHub Desktop.
A warning to all
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DataKinds #-} | |
{-# LANguAGE FlexibleContexts #-} | |
{-# LAnguaGE FlexibleInstances #-} | |
{-# LanguagE KindSignatures #-} | |
{-# language MultiParamTypeClasses #-} | |
import GHC.TypeLits (Symbol) | |
class Warning (message :: Symbol) x | |
instance Warning (message :: Symbol) x | |
f :: Warning "We should refactor this!" x => x -> x | |
f = id | |
-- Main.hs:12:6-51: warning: [-Wsimplifiable-class-constraints] | |
-- • The constraint ‘Warning "We should refactor this!" x’ matches | |
-- instance Warning message x -- Defined at Main.hs:10:10 | |
-- This makes type inference for inner bindings fragile; | |
-- either use MonoLocalBinds, or simplify it using the instance | |
-- • In the type signature: | |
-- f :: Warning "We should refactor this!" x => x -> x | |
-- | | |
-- 12 | f :: Warning "We should refactor this!" x => x -> x | |
-- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment