Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble with anonymous functions in records #8

Open
josyoun opened this issue Jan 25, 2015 · 1 comment
Open

Trouble with anonymous functions in records #8

josyoun opened this issue Jan 25, 2015 · 1 comment

Comments

@josyoun
Copy link

josyoun commented Jan 25, 2015

The following program:

{-# LANGUAGE NoImplicitPrelude, QuasiQuotes, DataKinds #-}

module Test01 where

import BasePrelude
import Record

data Foo t = Foo {faz :: t -> t} 
foo = Foo {faz = \x -> x }

bar = [r| {baz = \x -> x} |]

gives the error

ghc Test01 
[1 of 1] Compiling Test01           ( Test01.hs, Test01.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package containers-0.5.5.1 ... linking ... done.
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package bytestring-0.10.4.1 ... linking ... done.
Loading package text-1.2.0.4 ... linking ... done.
Loading package hashable-1.2.3.1 ... linking ... done.
Loading package scientific-0.3.3.7 ... linking ... done.
Loading package attoparsec-0.12.1.2 ... linking ... done.
Loading package base-prelude-0.1.14 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package transformers-0.4.2.0 ... linking ... done.
Loading package record-0.1.5 ... linking ... done.

Test01.hs:11:10:
    Parser failure: Failed reading: satisfy. Contexts: ["exp","'('"].
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1

Basically, I'd like to be able to put functions into the record and it doesn't look like it's working. I put an example of what I'd like to do above in foo, which uses plain vanilla records, and what I thought it should be using the record package in bar.

@nikita-volkov
Copy link
Owner

The parser doesn't yet support the lambda syntax.

You can extend it if you want and I'll accept the pull request. It'll require a parser for lambda syntax and patterns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants