Package hydra.haskell

Interface Utils


  • public interface Utils
    Utilities for working with Haskell syntax trees
    • Method Detail

      • applicationPattern

        static Pattern applicationPattern​(Name name,
                                          java.util.List<Pattern> args)
        Create an application pattern from a name and argument patterns
      • elementReference

        static Name elementReference​(ModuleNames<ModuleName> namespaces,
                                     Name name)
        Generate a Haskell name reference for a Hydra element
      • hslit

        static Expression hslit​(Literal lit)
        Create a Haskell literal expression
      • hsvar

        static Expression hsvar​(java.lang.String s)
        Create a Haskell variable expression from a string
      • namespacesForModule_growStep

        static <T1> java.util.Map<ModuleName,​java.lang.Integer> namespacesForModule_growStep​(java.util.function.Function<java.util.List<java.lang.String>,​java.util.function.Function<java.lang.Integer,​ModuleName>> aliasFromSuffix,
                                                                                                   java.util.List<ModuleName> nssAsList,
                                                                                                   java.util.function.Function<ModuleName,​java.util.List<java.lang.String>> segsFor,
                                                                                                   java.util.Map<ModuleName,​java.lang.Integer> state,
                                                                                                   T1 _ign)
      • namespacesForModule_takenFor

        static <T1> java.lang.Integer namespacesForModule_takenFor​(java.util.Map<T1,​java.lang.Integer> state,
                                                                   T1 nm)
      • newtypeAccessorName

        static java.lang.String newtypeAccessorName​(Name name)
        Generate an accessor name for a newtype wrapper (e.g., 'unFoo' for Foo)
      • rawName

        static Name rawName​(java.lang.String n)
        Create a raw Haskell name from a string without sanitization
      • recordFieldReference

        static Name recordFieldReference​(ModuleNames<ModuleName> namespaces,
                                         Name sname,
                                         Name fname)
        Generate a Haskell name for a record field accessor
      • sanitizeHaskellName

        static java.lang.String sanitizeHaskellName​(java.lang.String v1)
        Sanitize a string to be a valid Haskell identifier, escaping reserved words
      • simpleName

        static Name simpleName​(java.lang.String arg_)
        Create a sanitized Haskell name from a string
      • toTypeApplication

        static Type toTypeApplication​(java.util.List<Type> types)
        Convert a list of types into a nested type application
      • typeNameForRecord

        static java.lang.String typeNameForRecord​(Name sname)
        Extract the local type name from a fully qualified record type name
      • unionFieldReference

        static Name unionFieldReference​(java.util.Set<Name> boundNames,
                                        ModuleNames<ModuleName> namespaces,
                                        Name sname,
                                        Name fname)
        Generate a Haskell name for a union variant constructor, with disambiguation
      • unpackForallType

        static Pair<java.util.List<Name>,​Type> unpackForallType​(Type t)
        Unpack nested forall types into a list of type variables and the inner type