blob: a6755f71fc3be3d4e61e667829241e4f477fc77b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
import Data.Functor.Identity
data HideArg f where
HideArg :: f a -> HideArg f
data family App :: tF -> tF
data instance App f x = App1 (f x)
class WrappedIn s a | s -> a where
unwrap :: s -> a
instance WrappedIn (App f a) (f a) where
unwrap (App1 fa) = fa
pattern Unwrapped :: WrappedIn s a => a -> s
pattern Unwrapped x <- (unwrap -> x)
{-# COMPLETE Unwrapped :: App #-}
boom :: HideArg (App Identity) -> Bool
boom (HideArg (Unwrapped (Identity _))) = True
main :: IO ()
main = print ":("
|