Giter VIP home page Giter VIP logo

fmlist's People

Contributors

andreasabel avatar asr avatar bgamari avatar sjoerdvisscher avatar treeowl avatar utdemir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fmlist's Issues

Build error with GHC 8.4.1-alpha1

GHC 8.4.1-alpha1 was announced. While testing Agda with this version of GHC, I got an error on fmlist (master branch) related to a missing instance of Semigroup.

This error is reported as a warning in GHC 8.0.2/8.2.2 using the -Wsemigroup flag:

$ cabal install --force-reinstalls --ghc-options='-Wsemigroup -Werror'

So, fixing this warning on GHC 8.0.2/8.2.2 fix the error on GHC 8.4.1-alpha1.

Blocking agda/agda#2878.

zipWith is intolerably slow

last $ join zip (fromList [1..n]) seems, empirically, to be taking something like quadratic time. Thanks to the left-biased nature of zipWith, I don't think we can do much better than the obvious:

zipWith f xs ys = fromList $ L.zipWith f (toList xs) (toList ys)

What is transformCS for?

It's not at all obvious what transformCS actually does. Could you possibly explain? It's also not obvious to me why it's used rather than "naive" implementations. We certainly can write things like

take         :: (Ord n, Num n) => n -> FMList a -> FMList a
-- This is (essentially) what's in GHC.List, when transformed by
-- rewrite rules.
take n xs
  | 0 < n
  = foldr go (`seq` nil) xs n
  | otherwise
  = nil
  where
    go x r m = case m of
      1 -> one x
      _ -> x `cons` r (m - 1)

takeWhile    :: (a -> Bool) -> FMList a -> FMList a
takeWhile p  = foldr go nil
  where
    go x r
      | p x = x `cons` r
      | otherwise = nil

drop         :: (Ord n, Num n) => n -> FMList a -> FMList a
drop n xs | n <= 0 = xs
drop n0 xs0  = foldr go (`seq` nil) xs0 n0
  where
    go x r 0 = x `cons` r 0
    go x r n = r (n - 1)

Is there an efficiency advantage to the transformCS way?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.