let it leave me like a long breath

let it dissipate or fade in the background

(no subject)

Profile

xax: purple-orange {11/3 knotwork star, pointed down (Default)
howling howling howling

Nav

  • Recent Entries
  • Archive
  • Reading
  • Tags
  • Memories
  • Profile

Tags

  • art - 2 uses
  • asteroid garden - 4 uses
  • code - 19 uses
  • demos - 1 use
  • dreams - 5 uses
  • ff7 fangame - 23 uses
  • fic prompts - 13 uses
  • gamedev challenge - 82 uses
  • hell game - 76 uses
  • nanowrimo - 11 uses
  • plants - 9 uses
  • process - 52 uses
  • programming - 51 uses
  • screenshots - 5 uses
  • writing log - 83 uses

May 2025

S M T W T F S
    123
45678 910
1112131415 1617
18192021222324
25262728293031
  • Nov. 9th, 2015
  • xax: purple-orange {11/3 knotwork star, pointed down (Default)
    [personal profile] xax
    Tags:
    • code,
    • programming
    posted @ 01:46 pm

    {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances,
    UndecidableInstances, TypeFamilies #-}
    
    class Appl fun arg t where
      appl :: fun -> arg -> t
    
    instance (a ~ a') => Appl (a -> b) a' b where
      appl = id
    
    instance {-# OVERLAPPING #-} Appl fun arg (b -> t) => Appl fun (b, arg) t where
      appl f (n, rs) = appl f rs n
    
    class Appr fun arg t where
      appr :: fun -> arg -> t
    
    instance (a ~ a') => Appr (a -> b) a' b where
      appr f = f
    
    instance {-# OVERLAPPING #-} (a ~ a', Appr fun arg t) => Appr (a -> fun) (a', arg) t where
      appr f (a, x) = appr (f a) x
    

    s/o to lyxia @ #haskell who wrote the appr half of this, which was enough to finally get me to comprehend all these messed-up recursive instances

    (this generalizes the series of functions i enumerated here. the end goal is as always to unify all the render* functions in this code, which is a more complicated step, but now one i'm a lot more confident that i can figure out.)

    (also as you might discover if you try to use this code, it requires type hints for everything: function, argument, and result. there might be some way for fundeps to fix that, but i haven't figured that out yet either. i don't know how annoying that would be in practice, since in practice i think the types would be pinned down by use elsewhere.)

    • Previous Entry
    • Add Memory
    • Share This Entry
    • Next Entry
    • Reply
Page generated Jan. 23rd, 2026 02:01 am
Powered by Dreamwidth Studios

Style Credit

  • Style: (No Theme) for vertical