scott-encoding Questions

2

Solved

When I declare this newtype: newtype ListScott a = ListScott { unconsScott :: (a -> ListScott a -> r) -> r -> r } which would define the hypothetical rank-2 type ListScott :: ((...

3

This is a literate haskell post. Simply save it as "ChurchList.lhs" to run it. > {-# LANGUAGE Rank2Types #-} A Church encoded list is a way of representing a list via a function. It resembles...
Innocency asked 29/8, 2015 at 16:40

4

Solved

I've been using the Free datatype in Control.Monad.Free from the free package. Now I'm trying to convert it to use F in Control.Monad.Free.Church but can't figure out how to map the functions. For...
Arillode asked 14/7, 2015 at 5:45

2

Solved

An ADT can be represented using the Scott Encoding by replacing products by tuples and sums by matchers. For example: data List a = Cons a (List a) | Nil Can be encoded using the Scott Encoding ...

2

Solved

Or to be specific, why do we use foldr to encode lists and iteration to encode numbers? Sorry for the longwinded introduction, but I don't really know how to name the things I want to ask about so...
1

© 2022 - 2024 — McMap. All rights reserved.