1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Define a fixpoint over rank-n quantified mendler-style recursive functions.

This commit is contained in:
Rob Rix 2019-07-19 09:42:10 -04:00
parent 89cdd3bda3
commit 835506030b
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -1,4 +1,4 @@
{-# LANGUAGE FlexibleContexts, LambdaCase, OverloadedStrings, RankNTypes, RecordWildCards #-}
{-# LANGUAGE FlexibleContexts, LambdaCase, OverloadedStrings, RankNTypes, RecordWildCards, ScopedTypeVariables #-}
module Analysis.Eval
( eval
, prog1
@ -9,6 +9,7 @@ module Analysis.Eval
, prog6
, ruby
, Analysis(..)
, fix
) where
import Control.Effect.Fail
@ -26,6 +27,13 @@ import Data.Text (Text)
import GHC.Stack
import Prelude hiding (fail)
fix :: forall f a b
. ((forall x . (x -> a) -> f x -> b) -> (forall x . (x -> a) -> f x -> b))
-> (forall x . (x -> a) -> f x -> b)
fix f = x
where x :: (x -> a) -> f x -> b
x = f x
eval :: ( Carrier sig m
, Member (Reader Loc) sig
, MonadFail m